代码拉取完成,页面将自动刷新
#!/bin/bash
echo -e -n "\e[34;40m███╗ ███╗██╗ ██╗███████╗\e[0m";
echo -e -n "\e[32;40m \e[0m";
echo -e "\e[31;40m██████╗ ██╗ ██╗ ██╗███████╗\e[0m";
echo -e -n "\e[34;40m████╗ ████║╚██╗ ██╔╝██╔════╝\e[0m";
echo -e -n "\e[32;40m \e[0m";
echo -e "\e[31;40m██╔══██╗██║ ██║ ██║██╔════╝\e[0m";
echo -e -n "\e[34;40m██╔████╔██║ ╚████╔╝ ███████╗\e[0m";
echo -e -n "\e[32;40m█████╗\e[0m";
echo -e "\e[31;40m██████╔╝██║ ██║ ██║███████╗\e[0m";
echo -e -n "\e[34;40m██║╚██╔╝██║ ╚██╔╝ ╚════██║\e[0m";
echo -e -n "\e[32;40m╚════╝\e[0m";
echo -e "\e[31;40m██╔═══╝ ██║ ██║ ██║╚════██║\e[0m";
echo -e -n "\e[34;40m██║ ╚═╝ ██║ ██║ ███████║\e[0m";
echo -e -n "\e[32;40m \e[0m";
echo -e "\e[31;40m██║ ███████╗╚██████╔╝███████║\e[0m";
echo -e -n "\e[34;40m╚═╝ ╚═╝ ╚═╝ ╚══════╝\e[0m";
echo -e -n "\e[32;40m \e[0m";
echo -e "\e[31;40m╚═╝ ╚══════╝ ╚═════╝ ╚══════╝\e[0m";
i=0
str=""
arr=("|" "/" "-" "\\")
while [ $i -le 20 ]
do
let index=i%4
let indexcolor=i%8
let color=30+indexcolor
let NUmbER=$i*5
printf "\e[0;$color;1m[%-40s][%d%%]%c钰深plus脚本加载中\r" "$str" "$NUmbER" "${arr[$index]}"
sleep 0.1
let i++
str+='++'
done
printf "\n"
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
systemctl stop firewalld.service
systemctl disable firewalld.service
iptables -F
iptables -X
iptables -Z
service iptables save
echo -e -n "\e[31;40m 必须要先设置主机名且必须相同(y/n): \e[0m"
read pan
sed -i '$a192.168.200.11 mysql1' /etc/hosts
sed -i '$a192.168.200.12 mysql2' /etc/hosts
sed -i '$a192.168.200.13 mycat' /etc/hosts
cd /etc/yum.repos.d/
rm -rvf *
cat >>centos.repo<<OK
[centos]
name=centos
baseurl=ftp://192.168.200.11/centos
gpgcheck=0
enable=1
[gpmall]
name=gpmall
baseurl=ftp://192.168.200.11/gpmall-repo
gpgcheck=0
enable=1
OK
cd
yum clean all
yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel
yum install -y net-tools
yum install expect
scp -r root@192.168.200.11:/root/Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz /root
# expect -c"
# spawn scp -r root@192.168.200.11:/root/Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz /root
# expect{
# \"*assword\" {set timeout 3600; send \"000000\r\";}
# \"yes/no\" {set \"yes\r\"; exp_continue;}
# }
# expect eof"
tar -zvxf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz -C /usr/local/
chown -R 777 /usr/local/mycat/
sed -i '2i export MYCAT_HOME=/usr/local/mycat/' /etc/profile
source /etc/profile
# rm /usr/local/mycat/conf/schema.xml
echo y | rm /usr/local/mycat/conf/schema.xml
cat >>centos.repo<<OK
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name="TESTDB" checkSQLschema="true" sqlMaxLimit="100" dataNode="dn1"></schema>
<dataNode name="dn1" dataHost="localhost1" database="test" />
<dataHost name="localhost1" maxCon="1000" minCon="10" balance="3" dbType="mysql" dbDriver="native" writeType="0" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<writeHost host="hostM1" url="192.168.200.11:3306" user="root" password="000000">
<readHost host="hostS1" url="192.168.200.12:3306" user="root" password="000000" />
</writeHost>
</dataHost>
</mycat:schema>
OK
chown root:root /usr/local/mycat/conf/schema.xml
sed -i 's/<property name="password">123456</property>/<property name="password">000000</property>/g' /usr/local/mycat/conf/server.xml
/bin/bash /usr/local/mycat/bin/mycat start
netstat -ntlp
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。