Linux system if you want to understand the load between multiple database servers, then you will use the Clustershell tools, as a Linux operation tool, its installation and configuration is also a learning, then on Linux to install and configure Clustershell?
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
Be ready to query the current load on all database servers:
Shell Clush-b-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.
How do I configure the server for password-free logons?
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 later "USER" @ "server" can be replaced by the corresponding "HOST":
Shell "Cat ~/.ssh/config
Host db_1
Hostname "The SERVER"
User "user"
Port "Port"
Host db_2
Hostname "The SERVER"
User "user"
Port "Port"
Host Db_3
Hostname "The SERVER"
User "user"
Port "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 "USER" @ "SERVER" "Cat-" "~/.ssh/authorized_keys"
If you can't remember how to spell Authorized_keys correctly, you can go on to learn how to use Ssh-copy-id, a command that makes it easier to do things:
Shell "Ssh-copy-id-i ~/.ssh/id_rsa.pub" "USER" @ "SERVER"
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.
The above is the Linux installation configuration Clustershell method introduced, because the Clustershell installation configuration requires password-free logon server, so this article also made a related explanation.