【问题标题】:Chef Server installation issues厨师服务器安装问题
【发布时间】:2016-09-16 08:44:55
【问题描述】:

我一直在尝试使用本指南在我的 CentOS 6.5 机器上安装厨师服务器 (chef-server-core-12.1.0-1.el6.x86_64.rpm):http://docs.chef.io/server/install_server.html#standalone 这是一个测试环境,因此我没有 FQDN,但 IP 地址是可解析的。运行 chef-server-ctl reconfigure 后,我尝试使用以下命令创建用户:

[root@xxx-xxx-xxx-xxx ~]# chef-server-ctl user-create myusername myfirstname mylastname myemail mypassword --filename /root/myfile.pem

我在上述命令中填写了适当的详细信息,但我不断收到此错误:

ERROR: Connection refused connecting to https://127.0.0.1/users/, retry 5/5
ERROR: Network Error: Connection refused - Connection refused connecting to        https://127.0.0.1/users/, giving up
Check your knife configuration and network settings

ngnix 服务一直宕机,无法启动。查看日志后:

 tail -f /var/log/opscode/nginx/current 
 2015-07-01_10:59:00.69218 nginx: [emerg] invalid number of arguments in "server_name" directive in /var/opt/opscode/nginx/etc/chef_https_lb.conf:3

chef_https_lb.conf文件如下:

server {
listen 443;
server_name ;

access_log /var/log/opscode/nginx/access.log opscode;

我不确定出了什么问题。有没有大神指点一下?

【问题讨论】:

    标签: chef-infra


    【解决方案1】:

    万一有人偶然发现这个寻找答案(就像我一样)。 问题是你需要设置服务器的FQDN而不是localhost。

    Centos 6.6 示例

    在您的 /etc/hosts 文件中,读取(或类似)的第一行

    127.0.0.1 localhost
    

    将 localhost 更改为您为服务器设置的主机名 (/etc/sysconfig/network)

    127.0.0.1 servername.com
    

    重启你的网络服务

    $: service network restart
    

    当您在服务器终端上运行以下命令时

    $: hostname
    $: hostname -f
    

    它们都应该输出“servername.com”

    运行 chef-server-ctl reconfigure 为 chef 服务器重建 ssl 证书。

    您应该能够添加您的管理员用户 / ORG 和 opscode-manage 网络界面

    【讨论】:

    • 注意:我可以通过将$ hostname 的输出添加/etc/hosts 的第一行来获得相同的结果。谢谢你的回答!
    【解决方案2】:

    在我的例子中,nginx 无法绑定到端口 80,因为 apache2 已经在使用它。所以我的 chef-server-ctl tail nginx 看起来像这样

    # chef-server-ctl tail nginx                                                                                                                                                  
    ==> /var/log/opscode/nginx/internal-chef.access.log <==
    
    ==> /var/log/opscode/nginx/error.log <==
    2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
    2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
    2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
    2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
    2016/07/20 12:22:29 [emerg] 28912#0: still could not bind()
    

    所以我查看了 nginx.conf 文件并注释掉了侦听端口 80 的服务器 - 看到它仍然重定向到 443。然后我重新启动 nginx 和 chef-server-ctl user-create ... 工作:) 例如

    # vi /var/opt/opscode/nginx/etc/nginx.conf
     ...
        # We support three options: serve nothing on non_ssl_port (80),
        # redirect to https, or actually serve the API.
        #     server {
        #       listen 80;
        #       access_log /var/log/opscode/nginx/rewrite-port-80.log;
        #       return 301 https://$host$request_uri;
        #     }
    
    # chef-server-ctl restart nginx
    ok: run: nginx: (pid 32236) 0s
    # chef-server-ctl user-create username fname sname username@example.com password --filename username.pem
    

    【讨论】:

    • 完美!谢谢你:)
    【解决方案3】:

    您必须禁用 SELinux,以便 Chef 可以将其服务绑定到各种套接字/端口。您可能也必须禁用 qpid。

    见:

    http://docs.chef.io/server/install_server_pre.html

    尤其是: http://docs.chef.io/server/install_server_pre.html#selinux

    【讨论】:

    • 您好,感谢您的回复。我已将 SElinux 设置为许可模式,并且我的 CentOS 上没有安装 qpidd。加班我查看chef服务的状态:down: nginx: 0s,正常up,要up; run: log: (pid 4378) 11394s nginx 一直是,当我调用 chef-server-tcl start 时它会启动,但又会下降。
    • 我不确定这是否是问题 - nginx 正在关闭。为什么会下降?
    • 因为您的另一个网络服务器已经在端口 80/443/...上运行?
    • #netstat -anp | grep :80 给出:tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 24166/beam.smp 443 上没有任何运行。
    • 反向 DNS 损坏不存在?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-06
    • 2015-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多