motd.sh, to be executed under ~/.bash_profile # Auto-generate MOTD for MySQL/MariaDB Replication To achieve similar result, we can use a simple Bash script to produce a meaningful MOTD output to summarize our MySQL/MariaDB server, for example: $ vim ~/.motd.sh Using the default /etc/motd is only good for static content, which is not what we really want if we want to report the current state of a MySQL server. We can utilize Linux’s Message of the Day (MOTD) to automate this behaviour whenever we log into the server. It will be way better if we can get a summary of the database state whenever we are in that particular server, just to give us a heads up on what we are going to deal with. Replication topology tends to become more complex as your database cluster scales out and there could be many roles in a cluster like intermediate master, binlog server, backup master with semi-sync replication, read-only slaves and also backup verification server. If you are managing a database cluster with multiple roles like MySQL or MariaDB replication, it’s common to always have this anxious feeling when directly administering one of the hosts because we need to perform extra checks to verify that the node that we are in is the one that we really want to administer. You can use this free online tool to customize your bash prompt, to suit your taste. With mycli, one can reduce the human-error vector with a better visualization when dealing with production server, as shown in the following screenshot:Īs shown in the screenshot above, the current user (blue), server’s hostname (green), Production tier (bold in red colour with white background), together with the full path of the current directory (yellow) provides a better summary of the current session where the important information are easily distinguishable with different colours. To install the package, we can use pip (Python package manager): $ pip install mycli While for APT-based installation: $ apt-get install ntp pv socat htop innotop vim easy_install mailutils bind-utils sysstat net-tools telnet openssl lm_sensors ipmitoolįor MySQL command line interface, we can use another tool other than the standard “mysql” command line client like mycli, with auto-completion and syntax highlighting. $ yum install -y wget ntp pv socat htop innotop vim mailx bind-utils net-tools telnet sysstat openssl python-setuptools lm_sensors ipmitool Therefore, for YUM-based installation: $ yum install epel-release Note that some of the suggested packages are only available in non-default package repositories like EPEL for CentOS.
0 Comments
Leave a Reply. |