saltstack配置安装的一些关键步骤及安装时各种报错的分析

时间:2023-11-22 10:53:02

以下其他仅做参考,官方网址才是安装重点:http://docs.saltstack.cn/topics/installation/rhel.html

与安装相关的一些文档或资料:

一、linux服务器安装:

http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=12067603&id=4027192

源码安装与简单配置http://blog.chinaunix.net/uid-20908097-id-3984933.html

二、架构描述:http://www.361way.com/saltstack-install/3123.html

三、grain各类代理、设备静态设置

四、saltstack 的实际应用开发

http://xiaorui.cc/2014/11/18/%E7%94%A8saltstack%E7%9A%84returners%E5%AE%9E%E7%8E%B0%E6%89%B9%E9%87%8F%E7%9B%91%E6%8E%A7%E5%92%8C%E6%95%B0%E6%8D%AE%E5%AD%98%E5%82%A8/

五、zeroMQ消息队列处理http://www.bubuko.com/infodetail-450639.html

六、内嵌的openstack模块:

salt-openstack-utils-neutron 网络地址等资源管理,划分物理网络

salt-openstack-utils-nova计算组织控制器,计算所有活动的生命周期

swift 对象存储,兼具SAN高速直接访问磁盘特点及NAS的分布式共享特点。

七、salt安装:http://docs.saltstack.cn/topics/installation/rhel.html

八、安装完毕后,用命令查看启动进程是否起来

ps -ef | grep -i salt | grep -v saltsta+ | grep -v grep

九、必要时可祭出日志文件查看日志:cat /var/log/salt/minion

cat /var/log/salt/master

=================分割线=====================

一、一些低级错误:

1在代码里发现部分静态配置文件,例如/usr/lib/python2.7/site-packages/salt/config.py

DEFAULT_MASTER_OPTS = {

'interface': '0.0.0.0',

'publish_port': '4505',

'pub_hwm': 1000,

'auth_mode': 1,

千万不要手贱去改

2、vi /etc/salt/master修改user,若改错则提示无权限

3、/usr/lib/python2.7/site-packages/salt/config.py文件里的'interface'不为0.0.0.0时显示超时:

Salt request timed out. The master is not responding. If this error persists after verifying the master is up, worker_threads may need to be increased.

若正确后仍然超时,修改/etc/salt/master 的worker_threads,改大

二、启动saltmaster服务时,报错AttributeError: 'module' object has no attribute 'BASE_THORIUM_ROOTS_DIR'

在vi /etc/salt/master或site-packages的__init__.py注释掉BASE_THORIUM_ROOTS_DIR相关模块或源码  目前原因未明

三、在同一台电脑上装minion,然后进行测试:

1、yum install salt-minion

2、安装完毕后在/etc/salt的minion里写上master:127.0.0.1,master的ip

然后service salt-minion restart

3、输入salt-key list,显示minions:

- 10.1.240.181

minions_denied:

minions_pre:

minions_rejected:

已可查看到子机

四、在/etc/salt/master的配置文件中没有配置自动接收key,可以使用以下命令salt-key -A

显示如下时成功:The key glob '*' does not match any unaccepted keys.

五、一个问题引发的多种病症:

1、salt '*' sys.doc报错:

self._print_docs(ret)

File "/usr/lib/python2.7/site-packages/salt/cli/salt.py", line 344, in _print_docs

if ret[host][fun]:

TypeError: string indices must be integers, not str

Traceback (most recent call last):

File "/usr/bin/salt", line 10, in <module>

salt_main()

File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 458, in salt_main

client.run()

File "/usr/lib/python2.7/site-packages/salt/cli/salt.py", line 195, in run

self._output_ret(ret, out)

File "/usr/lib/python2.7/site-packages/salt/cli/salt.py", line 300, in _output_ret

self._print_docs(ret)

File "/usr/lib/python2.7/site-packages/salt/cli/salt.py", line 344, in _print_docs

if ret[host][fun]:

TypeError: string indices must be integers, not str

2、salt "*" cmd.run "df -h"

得到结果:

10.1.240.181:

Minion did not return. [No response]

3、使用调试语句:salt-minion -l debug

发现有类似报错:

in "<string>", line 44, column 1:

id:host172

^

could not found expected ':'

in "<string>", line 46, column 1:

# Append a domain to a hostname ...

原来/etc/salt/minion及/etc/salt/master配置文件中,master: 192.168.10.16等相关配置项的冒号后面都需要有一个空格,问题解决