Installation and configuration of Clustershell
Clustershell installation is easy, if the use of apt or yum package management, the basic is a command of things, I will not say, here to say how to install from the source code, you need to execute the following command in the source code directory:
shell> python setup.py Install
For ease of use, you will also need to copy the configuration files to the specified directory:
Shell> Mkdir/etc/clustershell
shell> CP conf/*/etc/clustershell
Then configure the node we want to manage, assuming we have a DB group configured with Db_[1-3] three nodes:
Shell> cat/etc/clustershell/groups
Db:db_1 db_2 Db_3
To be ready, follow the example at the beginning of the article: query all database servers for current load conditions:
shell> clush-g db "Uptime"
Note: The prerequisite is that you need to set the password-free login on the operating server, if not clear, please see the following content.
Article: How to configure the server password-free login?
If you do not generate the SSH key in advance, you need to be Mr.:
Shell> Ssh-keygen
Optional operation: For convenience, we can give the server that needs to log in a better readability alias, if you do a similar operation, then the following @ can be replaced by the corresponding:
Shell> Cat ~/.ssh/config
Host db_1
Hostname
User
Port
Host db_2
Hostname
User
Port
Host Db_3
Hostname
User
Port
The generated public key is then added to the specified location of the server where the login is required:
Shell> Cat ~/.ssh/id_rsa.pub | SSH @ "cat->> ~/.ssh/authorized_keys"
If you're like me, you can't remember how to spell Authorized_keys correctly, you can go on to learn the usage of Ssh-copy-id, which makes it easier to do things:
shell> ssh-copy-id-i ~/.ssh/id_rsa.pub "@"
Note: Each configured a password-free login server, it is best to manually actually operate, because the first connection will require manual confirmation of whether to save information to the ~/.ssh/known_hosts file.