顯示具有 MySQL 標籤的文章。 顯示所有文章
顯示具有 MySQL 標籤的文章。 顯示所有文章

VCS MySQL Agent Configuration

太久沒有碰到客戶用,又忘的差不多了,這次筆記下來吧


MySQL Agent Function
The operations or functions that the Symantec High Availability agent for MySQL
can perform are as follows:
online
$ BaseDir/bin/mysqld_safe --defaults-file=MyCnf --datadir=DataDir --user=MySQLUser
monitor
$ BaseDir/bin/mysqladmin --user=MySQLAdmin --password=MySQLAdminPasswd status
offline
$ BaseDir/bin/mysqladmin --user=MySQLAdmin --password=MySQLAdminPasswd shutdown
clean
$ BaseDir/bin/mysqladmin --user=MySQLAdmin --password=MySQLAdminPasswd shutdown


Create a MySQLAdmin user with shutdown privileages only:
# mysql -uroot -p{PASSWORD}
mysql> use mysql;
mysql> select user,host,password from user;
mysql> create user 'MySQLAdmin'@'localhost' identified by 'passw0rd' ;
mysql> create user 'MySQLAdmin'@'127.0.0.1' identified by 'passw0rd' ;
mysql> grant shutdown on *.* to 'MySQLAdmin'@'localhost' ;
mysql> grant shutdown on *.* to 'MySQLAdmin'@'l27.0.0.1' ;
mysql> select user,host,password from user;
mysql> flush privileges;

Test the user can shutdown the MySQL database
# $BaseDir/bin/mysqladmin --user=MySQLAdmin --password=passw0rd status
# $BaseDir/bin/mysqladmin --user=MySQLAdmin --password=passw0rd shutdown


Installation
# rpm -Uvh VRTSacclib-6.2.0.0-GENERIC.noarch.rpm
# rpm -Uvh VRTSmysql-6.2.0.0-GENERIC.noarch.rpm


Import MySQL resource type: 
/etc/VRTSagents/ha/conf/MySQL/MySQLTypes.cmd


Encrypt MySQLadmin password
# vcsencrypt -agent
Enter Password:
Enter Again:
GUGsHUjUJuNSvUIsK


VCS MySQL Resource Attribute
group MySQL (
        SystemList = { node1 = 0, node2 = 1 }
        )

        MySQL MySQLdb (
                Critical = 1
                MySQLAdmin = MySQLAdmin
                MySQLAdminPasswd = GUGsHUjUJuNSvUIsK   <=== encrypt password
                BaseDir = "/usr"
                DataDir = "/var/lib/mysql"
                MyCnf = "/etc/my.cnf"
                )


Running multiple instances of MySQL on a single node
VCS ENV file
#!/bin/ksh
MYSQL_UNIX_PORT=/tmp/mysql.sock; export MYSQL_UNIX_PORT
MYSQL_TCP_PORT=3307; export MYSQL_TCP_PORT