1 Star 0 Fork 0

李皓天/钰深plus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mycat.mysplus.sh 4.04 KB
一键复制 编辑 原始数据 按行查看 历史
李皓天 提交于 2021-12-25 05:06 . 钰深6代脚本
#!/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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/mashiro2/mys-plus.git
git@gitee.com:mashiro2/mys-plus.git
mashiro2
mys-plus
钰深plus
master

搜索帮助