我在生产中运行一个主minion配置,但我正在寻找一个无主配置。
我可以在隔离的机器上正确运行salt-call --local state.highstate,但是可以使用这样的CLI模块吗?
http://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.mysql.html
修改
下载一些调试和日志信息:
root@database-primary:~# salt-call --local mysql.db_exists '##########' -l debug
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: database-primary
[DEBUG ] Configuration file path: /etc/salt/minion
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] Could not LazyLoad mysql.db_exists
'mysql'' __virtual__ returned False
root@database-primary:~# tail -100 /var/log/salt/minion
2015-03-22 13:32:52,834 [salt.config ][DEBUG ][7319] Reading configuration from /etc/salt/minion
2015-03-22 13:32:52,965 [salt.loaded.int.grains.core][DEBUG ][7319] Please install 'virt-what' to improve results of the 'virtual' grain.
2015-03-22 13:32:52,990 [salt.utils.lazy ][DEBUG ][7319] LazyLoaded jinja.render
2015-03-22 13:32:52,992 [salt.utils.lazy ][DEBUG ][7319] LazyLoaded yaml.render
2015-03-22 13:32:52,999 [salt.utils.lazy ][DEBUG ][7319] LazyLoaded jinja.render
2015-03-22 13:32:53,000 [salt.utils.lazy ][DEBUG ][7319] LazyLoaded yaml.render
2015-03-22 13:32:54,121 [salt.utils.lazy ][DEBUG ][7319] Could not LazyLoad mysql.db_exists
答案 0 :(得分:1)
是的,您可以在没有主服务器的情况下运行所有执行模块。您遇到的问题是看起来您没有安装所需的MySQL python模块。
确保已安装python MySQLdb
模块。
答案 1 :(得分:0)
是的,你可以在无主模式下通过salt-call
运行你想要的任何执行模块(当你传入--local
参数或在你的minion配置中有file_client: local
时)
E.g。如果你想通过mysql模块创建一个名为newdb的数据库:
salt-call --local mysql.db_create 'newdb' 'utf8' 'utf8_general_ci'
state.highstate
只是另一个调用执行模块的示例,请参阅http://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.state.html#salt.modules.state.highstate