1. mysql

    cd “${INSTALL_PATH}”/mysql-5.7.32

    sed -i “s/192.168.21.230/$OPS_NODE_IP/g” ops_upgrade.sql
    sed -i “s/192.168.21.128/$SVC_NODE_IP/g” ops_upgrade.sql
    /opt/mysql/bin/mysql -h127.0.0.1 -u root -proot123 -e ‘source ops_platform.sql;use ops_platform;show tables’
    /opt/mysql/bin/mysql -h127.0.0.1 -u root -proot123 -e ‘source ops_upgrade.sql;select remark,name,LEFT(value, 60) from ops_platform.upgrade_config’

    /opt/mysql/bin/mysql -h127.0.0.1 -u root -proot123 -e “delete from mysql.user where user=’’ or host=’::1’”
    /opt/mysql/bin/mysql -h127.0.0.1 -u root -proot123 -e “grant REPLICATION SLAVE, REPLICATION CLIENT on . to ‘slave’@’%’ identified by ‘root123’;”

    /opt/mysql/bin/mysql -h127.0.0.1 -u root -proot123 -e “grant PROCESS, REPLICATION CLIENT, SELECT on . to ‘exporter_m’@’%’ identified by ‘exporter123’;”
    /opt/mysql/bin/mysql -h127.0.0.1 -u root -proot123 -e “grant PROCESS, REPLICATION CLIENT, SELECT on . to ‘exporter_s’@’%’ identified by ‘exporter123’;”
    /opt/mysql/bin/mysql -uroot -proot123 -h127.1 -e ‘show master status;’ | grep mysql-bin | awk ‘{print $1}’ >/tmp/mysql_master_info
    /opt/mysql/bin/mysql -uroot -proot123 -h127.1 -e ‘show master status;’ | grep mysql-bin | awk ‘{print $2}’ >>/tmp/mysql_master_info
    read -p “root@${OPS_NODE_IP}’s password:” root_pwd
    /usr/bin/expect <<-EOF
    set timeout 10
    spawn scp -o StrictHostKeyChecking=no /tmp/mysql_master_info ${OPS_NODE_USERNAME}@${OPS_NODE_IP}:/tmp/

    python服务

    cp -r ${INSTALL_PATH}/ops_python /opt/
    mv /opt/ops_python/ops-python.service /usr/lib/systemd/system/
    chmod 754 /usr/lib/systemd/system/ops-python.service
    systemctl daemon-reload
    systemctl enable ops-python.service
    cd /opt/ops_python
    #python_regular
    dockerip=$(docker inspect -f ‘{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ phoenix-ops-platform)
    echo “[\”$dockerip\”]” >ip.conf
    echo “python file list:” && ls -l && systemctl start ops-python.service
    echo “Is python service up?” && ps -ef | grep ops_main