|
1 | 1 | # geode-control
|
2 | 2 | A set of bash scripts to simplify control of a Apache Geode cluster
|
| 3 | + |
| 4 | +## The Purpose |
| 5 | + |
| 6 | +This set of scripts provides a consistent approach for starting Apache Geode cluster nodes. |
| 7 | + |
| 8 | +With this set of scripts you can: |
| 9 | + |
| 10 | +* Quickly start the cluster of Apache Geode nodes on a freshly provisioned machines |
| 11 | +* Remotely control Geode cluster from a single node |
| 12 | + - start / stop cluster |
| 13 | + - centrally apply configuration changes to the cluster nodes using trivial template mechanism |
| 14 | + - gather logs and statistics files |
| 15 | + - clean up working directories |
| 16 | +* Have coherent folder and configuration files layout |
| 17 | +* Have startup script and configuration files templates |
| 18 | + |
| 19 | + |
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +The bash scripts are primarily designed and tested on RHEL/CentOS 6.5. |
| 23 | + |
| 24 | +The desired Java runtime must be pre-installed and available at the Bash prompt. |
| 25 | + |
| 26 | +A copy of Apache Geode / Gemfire installation at arbitrary file system location with Geode / Gemfire `bin` |
| 27 | +folder added to the `PATH` environment variable. |
| 28 | + |
| 29 | +Password-less SSH authentication between the "master" and other cluster machines. |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +Create a folder at the arbitrary file system location better ouside of any Geode/Gemfire installation. |
| 34 | +It is convenient to have a stable symlink to the effective Geode/Gemfire installation folder, e.g. |
| 35 | +```` |
| 36 | +ls -l /opt |
| 37 | +lrwxrwxrwx. 1 root root 91 Oct 28 17:23 gemfire -> Pivotal_GemFire_8201_b17966_Linux/ |
| 38 | +drwxr-xr-x. 11 root root 4096 Oct 23 17:26 Pivotal_GemFire_8201_b17966_Linux |
| 39 | +```` |
| 40 | + |
| 41 | +Copy or checkout the current repository to an arbitrary folder in your file system where the cluster instances |
| 42 | +will be based e.g. |
| 43 | +```` |
| 44 | +cd ~ |
| 45 | +git clone https://github.com/sshcherbakov/geode-control.git |
| 46 | +cd ~/geode-control |
| 47 | +```` |
| 48 | + |
| 49 | +Create empty folder at the same location (`~/geode-control`) on all machines that will host the cluster. |
| 50 | +The current user must have same read/write permissions to that folder on each of the machines. |
| 51 | + |
| 52 | +Set the password-less authentication between the current machine (the master one) and other machines where you |
| 53 | +plan to run Geode / Gemfire nodes. [Here](http://hortonworks.com/kb/generating-ssh-keys-for-passwordless-login/) is an example how to do that. |
| 54 | + |
| 55 | +Modify the `config/hostlist` describing the hosts where the cluster members are going to run. Each line of the file represents one Geode/Gemfire process instance and is specified in the following format: |
| 56 | +```` |
| 57 | +<target_hostname> <locator|server> <instance_name> |
| 58 | +```` |
| 59 | + |
| 60 | +The `target_hostname` here is the name that will be used by the script to login via SSH remotely. |
| 61 | +The `locator` or `server` parameter specifies which kind of Geode/Gemfire node to start respectively. |
| 62 | +The `instance_name` is the name of the Geode/Gemfire process instance that will also be used as a folder name for the |
| 63 | +instance related files. |
| 64 | + |
| 65 | + |
| 66 | +Place custom Jar files that need to be available at the Geode/Gemfire classpath at runtime to the optional `lib/` subfolder. |
| 67 | + |
| 68 | +We are basically set now. The following commands will bring the Geode cluster up and running. |
| 69 | + |
| 70 | +### Configuration deployment |
| 71 | + |
| 72 | +```` |
| 73 | +bin/cluster deploy |
| 74 | +```` |
| 75 | +copies the contents of `bin/`, `config/` and `lib/` subfolders to the cluster member machines as specified in the `config/hostlist` file. |
| 76 | +The placeholders in the property files get substituted with the local environment variables on each host accordingly. |
| 77 | + |
| 78 | +### Cluster start |
| 79 | + |
| 80 | +```` |
| 81 | +bin/cluster start |
| 82 | +```` |
| 83 | + |
| 84 | +Starts all cluster nodes |
| 85 | + |
| 86 | + |
| 87 | +### Cluster stop |
| 88 | + |
| 89 | +```` |
| 90 | +bin/cluster stop |
| 91 | +```` |
| 92 | + |
| 93 | +Starts all running cluster nodes |
| 94 | + |
| 95 | +### Clean up log and work folder |
| 96 | + |
| 97 | +```` |
| 98 | +bin/cluster clean |
| 99 | +```` |
| 100 | + |
| 101 | +Removes all log and Geode/Gemfire work files located in the `var/` subfolder on each machine. |
| 102 | + |
| 103 | + |
| 104 | +### Gather logs and stats files |
| 105 | + |
| 106 | +```` |
| 107 | +bin/cluster logs |
| 108 | +```` |
| 109 | + |
| 110 | +Gathers all Geode/Gemfire logs and statistics files from all cluster machines into a singe compressed time stamped tar ball file |
| 111 | +placed in the current directory. The file contents is flattened with the log and stats file names indicating the originating Geode/Gemifre instance. |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | +## Folder structure |
| 116 | +```` |
| 117 | +root@vf0 geode-control]# tree |
| 118 | +. |
| 119 | +├── bin <-- geode-control scripts |
| 120 | +│ ├── cluster <-- main script for the cluster control |
| 121 | +│ ├── start-locator <-- includes process environment variables |
| 122 | +│ ├── start-server <-- includes process environment variables |
| 123 | +│ ├── stop-locator |
| 124 | +│ └── stop-server |
| 125 | +├── config <-- configuration file templates for all cluster participants |
| 126 | +│ ├── cache.xml |
| 127 | +│ ├── gemfire-locator.properties |
| 128 | +│ ├── gemfire-server.properties |
| 129 | +│ └── hostlist |
| 130 | +├── etc <-- runtime configuration |
| 131 | +│ ├── locator1 <-- runtime Gode/Gemfire instance configuration with subsituted placeholders |
| 132 | +│ │ └── gemfire.properties |
| 133 | +│ └── server1 <-- runtime Gode/Gemfire instance configuration with subsituted placeholders |
| 134 | +│ ├── cache.xml |
| 135 | +│ └── gemfire.properties |
| 136 | +├── lib <-- custom Jars to add to each cluster instance classpath at runtime |
| 137 | +│ ├── my.jar |
| 138 | +└── var |
| 139 | + ├── log <-- Geode/Gemfire instance logs |
| 140 | + │ ├── locator1 |
| 141 | + │ │ ├── locator1-vf0.log |
| 142 | + │ │ └── meta-locator1-vf0-01.log |
| 143 | + │ └── server1 |
| 144 | + │ ├── meta-server1-vf0-01.log |
| 145 | + │ ├── server1-vf0-01-00.marker |
| 146 | + │ ├── server1-vf0.gfs |
| 147 | + │ └── server1-vf0.log |
| 148 | + └── work <-- Geode/Gemfire work folders |
| 149 | + ├── locator1 |
| 150 | + │ ├── ConfigDiskDir_locator1 |
| 151 | + │ │ ├── BACKUPcluster_config_1.crf |
| 152 | + │ │ ├── BACKUPcluster_config_1.drf |
| 153 | + │ │ ├── BACKUPcluster_config.if |
| 154 | + │ │ └── DRLK_IFcluster_config.lk |
| 155 | + │ ├── GemFire_root |
| 156 | +... |
| 157 | + │ ├── locator10334state.dat |
| 158 | + │ ├── locator10334views.log |
| 159 | + │ └── vf.gf.locator.pid |
| 160 | + └── server1 |
| 161 | + └── vf.gf.server.pid |
| 162 | +```` |
| 163 | + |
| 164 | +After deployment and startup step the file structure is identical on all cluster machines. |
| 165 | + |
0 commit comments