-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a22a2f
commit ed11bd0
Showing
7 changed files
with
705 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# common/utils.sh | ||
|
||
Provides common utility functions | ||
|
||
* [populate_nodeinfo()](#populatenodeinfo) | ||
* [is_hadoop2_cluster()](#ishadoop2cluster) | ||
* [is_hs2_enabled()](#ishs2enabled) | ||
* [is_hs2_cluster()](#ishs2cluster) | ||
* [is_master_node()](#ismasternode) | ||
* [is_worker_node()](#isworkernode) | ||
|
||
|
||
## populate_nodeinfo() | ||
|
||
Function to populate nodeinfo | ||
|
||
Please call this method at start of node bootstrap | ||
|
||
### Example | ||
|
||
```bash | ||
populate_nodeinfo | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
## is_hadoop2_cluster() | ||
|
||
Function to check if the node belongs to a Hadoop2 cluster | ||
|
||
### Example | ||
|
||
```bash | ||
if is_hadoop2_cluster; then | ||
# do something here | ||
fi | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
### Exit codes | ||
|
||
* **0**: If the cluster runs hadoop2 | ||
* **1**: Otherwise | ||
|
||
## is_hs2_enabled() | ||
|
||
Function to check if a HiveServer2 is configured to run on a master node | ||
|
||
### Example | ||
|
||
```bash | ||
if is_hs2_enabled; then | ||
# do something here | ||
fi | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
### Exit codes | ||
|
||
* **0**: When HiveServer2 is configured on a master node | ||
* **1**: Otherwise | ||
|
||
## is_hs2_cluster() | ||
|
||
Function to check if a node belongs to a HiveServer2 cluster | ||
|
||
### Example | ||
|
||
```bash | ||
if is_hs2_cluster; then | ||
# do something here | ||
fi | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
### Exit codes | ||
|
||
* **0**: When node belongs to a HiveServer2 cluster | ||
* **1**: Otherwise | ||
|
||
## is_master_node() | ||
|
||
Function to check if a node is a cluster master node | ||
|
||
### Example | ||
|
||
```bash | ||
if is_master_node; then | ||
# do something here | ||
fi | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
### Exit codes | ||
|
||
* **0**: When node is a cluster master node | ||
* **1**: Otherwise | ||
|
||
## is_worker_node() | ||
|
||
Function to check if a node is a cluster worker node | ||
|
||
### Example | ||
|
||
```bash | ||
if is_worker_node; then | ||
# do something here | ||
fi | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
### Exit codes | ||
|
||
* **0**: When node is a cluster worker node | ||
* **1**: Otherwise | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# hadoop/util.sh | ||
|
||
Provides Hadoop2 utility functions | ||
|
||
* [restart_master_services()](#restartmasterservices) | ||
* [restart_worker_services()](#restartworkerservices) | ||
* [restart_hadoop_services()](#restarthadoopservices) | ||
* [use_java8()](#usejava8) | ||
* [wait_until_namenode_running()](#waituntilnamenoderunning) | ||
|
||
|
||
## restart_master_services() | ||
|
||
Function to restart hadoop services on the cluster master | ||
|
||
This may be used if you're using a different version | ||
of Java, for example | ||
|
||
### Example | ||
|
||
```bash | ||
restart_master_services | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
## restart_worker_services() | ||
|
||
Function to restart hadoop services on the cluster workers | ||
|
||
This only restarts the datanode service since the | ||
nodemanager is started after the bootstrap is run | ||
|
||
### Example | ||
|
||
```bash | ||
restart_worker_services | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
## restart_hadoop_services() | ||
|
||
Generic function to restart hadoop services | ||
|
||
### Example | ||
|
||
```bash | ||
restart_hadoop_services | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
## use_java8() | ||
|
||
Use Java 8 for hadoop daemons and jobs | ||
|
||
By default, the hadoop daemons and jobs on Qubole | ||
clusters run on Java 7. Use this function if you would like | ||
to use Java 8. This is only required if your cluster: | ||
1. is in AWS, and | ||
2. is running Hive or Spark < 2.2 | ||
|
||
### Example | ||
|
||
```bash | ||
use_java8 | ||
``` | ||
|
||
_Function has no arguments._ | ||
|
||
## wait_until_namenode_running() | ||
|
||
Wait until namenode is out of safe mode | ||
|
||
### Example | ||
|
||
```bash | ||
wait_until_namenode_running 25 5 | ||
``` | ||
|
||
### Arguments | ||
|
||
* **$1** (int): Number of attempts function will make to get namenode out of safemode. Defaults to 50 | ||
* **$2** (int): Number of seconds each attempt will sleep for, waiting for namenode to come out of sleep mode. Defaults to 5 | ||
|
Oops, something went wrong.