华为云4

abc
vim /etc/ansible/hosts
写mycat的3台主机

ansible mycat -m yum -a "name=java-1.8.0-openjdk-devel state=latest"
ansible mycat -m shell -a "jps'
拷贝Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz
tar -zxf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz
rm -rf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz
cd mycat/
ls
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
ll
cd bin/
ls
chmod 755 *
ll
cd ..
vim server.xml

ansible mycat --list-hosts
rsync -aSH --delete mycat 三台mycat的IP:/usr/local/
ansible mycat -m yum -a "name=rsync state=latest"
ssh 1台mycat
cd /usr/local/mycat
ls
./bin/mycat start
jps
ssh -tunl
ssh 192.168.1.11

mysql -uuser -puser -h一台mycat -P8066
show databases;
use v_mysql;
show tables;
select * from user\G
select @@hostname;可以看到不同的负载均衡
select @@hostname;
select @@hostname;
select @@hostname;
select @@hostname;

mysql -uroot -p123456 -hmycat -P8066
show databases;
use v_mysql;
select * from user\G
create user "test"@“%”;
use v_mysql;
update user set authentication_string=password("aaa") where user="test";
flush privileges;

随便找一台从库
mysql -uroot -ptoor -h192.168.1.11
select * from mysql.user where user="test"\G
再换一台从库试试看
mysql -uroot -ptoor -h192.168.1.13
select * from mysql.user where user="test"\G


rsync -aSH --delete mycat 三台mycat的IP:/usr/local/
进入每个mycat
/usr/local/mycat/bin/mycat start
jps


balance
ss -ant

 

转载于:https://www.cnblogs.com/summer2/p/10798511.html

你可能感兴趣的:(数据库,运维,开发工具)