0
我正在嘗試使用salt設置正在運行的MariaDB實例的副本。這裏是我的代碼:使用salt-state的MariaDB複製未找到
{% if pillar.get('REPLICATION_SOURCE_IP') and pillar.get('REPLICATION_SOURCE_PORT') %}
replication-set-gtid:
mysql_query.run:
- database: mysql
- query: |
set @MY_GTID_EXEC = @@GLOBAL.GTID_EXECUTED;
RESET MASTER;
set GLOBAL GTID_PURGED = @MY_GTID_EXEC;
replication-connect-to-master:
mysql_query.run:
- database: mysql
- query: |
CHANGE MASTER TO MASTER_HOST='{{pillar['REPLICATION_SOURCE_IP']}}',
MASTER_PORT={{pillar['REPLICATION_SOURCE_PORT']}},
MASTER_USER='{{pillar['REPLICATION_REPLICA_USERNAME']}}',
MASTER_PASSWORD='{{pillar['REPLICATION_REPLICA_PASSWORD']}}',
MASTER_AUTO_POSITION=1,
MASTER_CONNECT_RETRY=15
replication-start-replica:
mysql_query.run:
- database: mysql
- query: "START SLAVE"
wait-for-slave:
cmd.run:
- name: until [[ $(mysql -P {{pillar['PORT']}} -e "show global status like 'slave_running'" mysql | grep 'Slave_running' | cut -f 2) == 'ON' ]]; do sleep 1; done
{% endif %}
我越來越從鹽僕從記錄以下錯誤:
[ERROR ] State 'mysql_query.run' was not found in SLS 'mariadb-10_1_00-replication-prepare-replica'
Reason: 'mysql_query' __virtual__ returned False
我使用的MariaDB的圖像包含這些依賴關係:
sudo yum install MariaDB-client -y
sudo yum install python-devel mysql-devel -y
sudo yum -y install gcc gcc-c++ kernel-devel
sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel
sudo pip install MySQL-python
我不確定可能會導致此問題。有什麼建議嗎?