Member since
04-03-2019
962
Posts
1743
Kudos Received
146
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
11539 | 03-08-2019 06:33 PM | |
4914 | 02-15-2019 08:47 PM | |
4171 | 09-26-2018 06:02 PM | |
10601 | 09-07-2018 10:33 PM | |
5678 | 04-25-2018 01:55 AM |
05-22-2016
11:08 AM
15 Kudos
I have written ambari-admin utility to simplify efforts required to find and trigger API curl call. I'm planning to add many more features than ambari-shell. Currently below features are supported. Demo on multinode cluster: 1. Clone our github repo to your local machine or any of the node in your cluster.
[root@sme-ambari-server ~]# git clone https://github.com/crazyadmins/useful-scripts.git
Initialized empty Git repository in /root/useful-scripts/.git/
remote: Counting objects: 106, done.
remote: Total 106 (delta 0), reused 0 (delta 0), pack-reused 106
Receiving objects: 100% (106/106), 16.89 KiB, done.
Resolving deltas: 100% (37/37), done.
2. Goto useful-scripts/ambari/
[root@sme-ambari-server ~]# cd useful-scripts/ambari/
3. Edit ambari.props and modify value of below parameters as per your cluster environment
[root@sme-ambari-server ambari]# cat ambari.props
CLUSTER_NAME=sme
AMBARI_ADMIN_USER=admin
AMBARI_ADMIN_PASSWORD=admin
AMBARI_HOST=sme-ambari-server.hwxblr.com
KDC_HOST=sme-ambari-server.hwxblr.com
REALM=HWX.COM
KERBEROS_CLIENTS=sme-ambari-server.hwxblr.com,kknew1.hwxblr.com,kknew2.hwxblr.com,kknew3.hwxblr.com
##### Notes #####
#1. KERBEROS_CLIENTS - Comma separated list of Kerberos clients in case of multinode cluster
#2. Admin princial is admin/admin and password is hadoop
Note - You can ignore Kerberos related parameters for now, in future this script will have functionality to setup Kerberos. 4. To print usage you can run ambari-admin.sh without any argument
Please refer first screenshot provided at the beginning of this article. 5. Stop All services
[root@sme-ambari-server ambari]# ./ambari-admin.sh stopall
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=14oisfe8i5bclm8tdk3npm390;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 152
Server: Jetty(8.1.17.v20150415)
{
"href" : "http://sme-ambari-server.hwxblr.com:8080/api/v1/clusters/sme/requests/61",
"Requests" : {
"id" : 61,
"status" : "Accepted"
}
6. Start all the services
[root@sme-ambari-server ambari]# ./ambari-admin.sh startall
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=1lo2x6u1r5xq319suwh8xiiquw;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 152
Server: Jetty(8.1.17.v20150415)
{
"href" : "http://sme-ambari-server.hwxblr.com:8080/api/v1/clusters/sme/requests/62",
"Requests" : {
"id" : 62,
"status" : "Accepted"
}
7. Get list of all services installed in your cluster, script also shows list of installed components host_wise
[root@sme-ambari-server ambari]# ./ambari-admin.sh listall
Below is the list of installed services in your cluster:
HDFS
MAPREDUCE2
SMARTSENSE
TEZ
YARN
ZOOKEEPER
########################### List of Host-wise installed components ###########################
kknew1.hwxblr.com
"component_name" | "DATANODE"
"component_name" | "HDFS_CLIENT"
"component_name" | "HST_AGENT"
"component_name" | "HST_SERVER"
"component_name" | "MAPREDUCE2_CLIENT"
"component_name" | "NAMENODE"
"component_name" | "NODEMANAGER"
"component_name" | "YARN_CLIENT"
"component_name" | "ZOOKEEPER_CLIENT"
kknew2.hwxblr.com
"component_name" | "DATANODE"
"component_name" | "HDFS_CLIENT"
"component_name" | "HST_AGENT"
"component_name" | "MAPREDUCE2_CLIENT"
"component_name" | "NODEMANAGER"
"component_name" | "SECONDARY_NAMENODE"
"component_name" | "YARN_CLIENT"
"component_name" | "ZOOKEEPER_CLIENT"
"component_name" | "ZOOKEEPER_SERVER"
kknew3.hwxblr.com
"component_name" | "APP_TIMELINE_SERVER"
"component_name" | "DATANODE"
"component_name" | "HDFS_CLIENT"
"component_name" | "HISTORYSERVER"
"component_name" | "HST_AGENT"
"component_name" | "MAPREDUCE2_CLIENT"
"component_name" | "NODEMANAGER"
"component_name" | "RESOURCEMANAGER"
"component_name" | "TEZ_CLIENT"
"component_name" | "YARN_CLIENT"
"component_name" | "ZOOKEEPER_CLIENT"
"component_name" | "ZOOKEEPER_SERVER"
sme-ambari-server.hwxblr.com
"component_name" | "HDFS_CLIENT"
"component_name" | "HST_AGENT"
"component_name" | "MAPREDUCE2_CLIENT"
"component_name" | "TEZ_CLIENT"
"component_name" | "YARN_CLIENT"
"component_name" | "ZOOKEEPER_CLIENT"
8. Stop individual service
[root@sme-ambari-server ambari]# ./ambari-admin.sh stop yarn
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=10tyime2kd7pr1e0o4t8gwg2jv;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 152
Server: Jetty(8.1.17.v20150415)
{
"href" : "http://sme-ambari-server.hwxblr.com:8080/api/v1/clusters/sme/requests/63",
"Requests" : {
"id" : 63,
"status" : "Accepted"
}
}
9. Start Individual service
[root@sme-ambari-server ambari]# ./ambari-admin.sh start yarn
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=a7wdqn56clk8176d99rm20hz5;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 152
Server: Jetty(8.1.17.v20150415)
{
"href" : "http://sme-ambari-server.hwxblr.com:8080/api/v1/clusters/sme/requests/64",
"Requests" : {
"id" : 64,
"status" : "Accepted"
}
}
10. Stop Individual service component
[root@sme-ambari-server ambari]# ./ambari-admin.sh stop hst_agent kknew2.hwxblr.com
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=vrmnhicrgog42lmu7exfqdm4;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 152
Server: Jetty(8.1.17.v20150415)
{
"href" : "http://sme-ambari-server.hwxblr.com:8080/api/v1/clusters/sme/requests/65",
"Requests" : {
"id" : 65,
"status" : "Accepted"
}
}
11. Start Individual service component
[root@sme-ambari-server ambari]# ./ambari-admin.sh start hst_agent kknew2.hwxblr.com
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=1fqqp5vqpourgjll9ydnyev3e;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 152
Server: Jetty(8.1.17.v20150415)
{
"href" : "http://sme-ambari-server.hwxblr.com:8080/api/v1/clusters/sme/requests/66",
"Requests" : {
"id" : 66,
"status" : "Accepted"
}
}
12. Remove any Hadoop client from any of the host
[root@sme-ambari-server ambari]# ./ambari-admin.sh remove tez_client kknew3.hwxblr.com
13. Add any Hadoop client on any of the host
[root@sme-ambari-server ambari]# ./ambari-admin.sh add tez_client kknew3.hwxblr.com
HTTP/1.1 201 Created
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=pl31hyai9aqt1eyeaj5ehe9i;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 0
Server: Jetty(8.1.17.v20150415)
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=18tzs8uctj2061pmjegp129aqz;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 152
Server: Jetty(8.1.17.v20150415)
{
"href" : "http://sme-ambari-server.hwxblr.com:8080/api/v1/clusters/sme/requests/67",
"Requests" : {
"id" : 67,
"status" : "Accepted"
}
}
Sleeping for 5 seconds before starting TEZ_CLIENT
HTTP/1.1 200 OK
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
User: admin
Set-Cookie: AMBARISESSIONID=1bh3u5foki8vh1fgg240i49h6x;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 0
Server: Jetty(8.1.17.v20150415)
14. Backup database for Hive/Oozie/Ambari
Note - Please enter your database password, for e.g. in this demo I have entered default password('bigdata') for Ambari postgresql DB.
[root@sme-ambari-server ambari]# ./ambari-admin.sh backup ambari postgresql sme-ambari-server.hwxblr.com
Password:
[root@sme-ambari-server ambari]# ls -lrt ~/ambari_db_backup_2016_05_22_11_32.sql
-rw-r--r-- 1 root root 6812385 May 22 11:33 /root/ambari_db_backup_2016_05_22_11_32.sql
[root@sme-ambari-server ambari]# date
Sun May 22 11:33:20 UTC 2016
[root@sme-ambari-server ambari]#
Note - I'm planning to add below features to this script, please feel to provide your feedback on this 🙂 Please feel free to suggest if you would like to have any more features! Stay Tuned for Part-2 Happy Hadooping!! 🙂
... View more
Labels:
05-22-2016
10:10 AM
@shivom mali - You can use same script, only you need to add comma separate hosts in ambari.properties for KERBEROS_CLIENTS
... View more
05-21-2016
07:18 PM
6 Kudos
@Anandha L Ranganathan
Please run below commands by root user. 1. Put Active NN in safemode sudo -u hdfs hdfs dfsadmin -safemode enter 2. Do a savenamespace operation on Active NN
sudo -u hdfs hdfs dfsadmin -saveNamespace 3. Leave Safemode sudo -u hdfs hdfs dfsadmin -safemode leave 4. Login to Standby NN 5. Run below command on Standby namenode to get latest fsimage that we saved in above steps. sudo -u hdfs hdfs namenode -bootstrapStandby -force
... View more
05-21-2016
07:09 PM
@Montrial Harrell Can you please check oozie launcher logs? Please refer this article. You can post logs here so that we can have a look at it, most probably "stderr" part of launcher logs should give you a hint.
... View more
05-21-2016
07:07 PM
1 Kudo
@Manoj Dhake - Can you please check stderr in Oozie launcher logs?
... View more
05-21-2016
07:02 PM
6 Kudos
@Sridhar Bandaru
I have written a utility(work is still in progress) which can be very helpful in your case. 1. Clone my repository git clone https://github.com/crazyadmins/useful-scripts.git 2. Goto useful-scripts/ambari/ 3. Edit ambari.properties according to your cluster environment 4. Start using script 🙂 Here is the usage screenshot: Happy Hadooping!! 🙂
... View more
05-20-2016
06:07 PM
3 Kudos
@jzhang Please check if your secondary namenode has latest checkpoint? if yes then try to restore fsimage from latest checkpoint. If you have latest checkpoint from secondary NN ######### 1. Create
dfs.name.dir on your new NameNode (it must be empty) 2. Make sure
fs.checkpoint.dir is pointed at your last known good copy 3. Start the
NameNode with the -importCheckpoint option 4. The NameNode will
verify that the files in fs.checkpoint.dir are consistent and create a new copy
of the FsImage and EditLog in dfs.name.dir. Your NameNode should
start functioning again and will exit safemode once the appropriate number of
blocks have been reported. The NameNode will not alter the files in
fs.checkpoint.dir.
... View more
05-20-2016
06:03 PM
@Vandana K R What happens when you try to connect to single hiveserver2? does it work?
... View more
05-16-2016
07:04 PM
@Tim Veil I could not find REST API to update queue mappings however I could think of using /var/lib/ambari-server/resources/scripts/configs.sh to update queue mapping(yarn.scheduler.capacity.queue-mappings) programmatically
... View more
05-16-2016
06:51 PM
2 Kudos
https://issues.apache.org/jira/browse/AMBARI-14941 - Looks like custom widgets for Kafka are supported in Ambari-2.2.2 Thanks to @jaimin
... View more