# 下载所有离线文件

wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/4.1.6

wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/123
wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/v4.1.6/rancher-1.20.4-image.tar.gz


wget https://oss.demo.uavcmlc.com:18000/cmlc-installation/v4.1.6/rke


# 批量复制文件
ip_list=(10.20.1.133 10.20.1.134 10.20.1.132)
for ip in "${ip_list[@]}"; do

    echo "yes
    yes
    " | scp /etc/docker/daemon.json root@${ip}:/etc/docker/daemon.json

    ssh root@${ip} "systemctl restart docker"
done

ip_list=(10.20.1.133 10.20.1.134 10.20.1.132)
for ip in "${ip_list[@]}"; do
    scp /etc/docker/daemon.json root@${ip}:/etc/docker/daemon.json
#    scp /etc/ssh/sshd_config root@${ip}:/etc/ssh/sshd_config

    ssh root@${ip} "systemctl restart docker"
#    ssh root@${ip} "systemctl restart sshd"
done


vim /etc/docker/daemon.json
{
  "insecure-registries" : ["10.20.1.130:8033"]
}

systemctl restart docker

# 生成ed25519 版本的ssh key
ssh-keygen -t ed25519 -f .ssh/id_ed25519  -C "m@github"

echo $(cat .ssh/id_ed25519.pub)

echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHXDzet+Z2/AmrzIZpPviz7Z9AMxLWiJUOwtj/3NPauk m@github" >>.ssh/authorized_keys

# 修改calico-node检测的IP
kubectl -n kube-system edit daemonset calico-node
env:
- name: FELIX_INTERFACEPREFIX
  value: "eth0"

docker pull rancher/coreos-flannel:v0.13.0-rancher1
docker tag rancher/coreos-flannel:v0.13.0-rancher1 10.20.1.130:8033/rancher/coreos-flannel:v0.13.0-rancher1

docker push 10.20.1.130:8033/rancher/coreos-flannel:v0.13.0-rancher1

./mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 < /root/install/mysql/all_tables_demo_4.1.6.sql

NEW_UPDATED_SQL_FILE_FOLDER=/root/install/mysql/master_data_4.1.6
NEW_UPDATED_SQL_FILE_FOLDER=/root/install/mysql/manual_script
for sql_file in $(ls ${NEW_UPDATED_SQL_FILE_FOLDER}); do
    echo "current file is ${sql_file}"
    ./mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306 <"$NEW_UPDATED_SQL_FILE_FOLDER/${sql_file}"
    echo "------------------"
    echo ""
done

./mysql -uroot -pQzfXQhd3bQ -h127.0.0.1 -P33306
