已经在使用的地址:AH00073:make_sock:当我启动httpd时无法侦听地址[::]:5000上的连接

时间:2017-07-24 08:01:00

标签: apache

我使用以下命令启动httpd:

[root@ha-node1 httpd]# systemctl start httpd.service 

但是得到错误:

  

httpd.service的作业失败,因为控制进程退出并显示错误代码。有关详细信息,请参阅“systemctl status httpd.service”和“journalctl -xe”。

所以我使用recommended命令查看日志信息:

[root@ha-node1 keystone]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-07-24 15:39:45 CST; 255ms ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 63103 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 63101 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 63101 (code=exited, status=1/FAILURE)

Jul 24 15:39:45 ha-node1 httpd[63101]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:5000
Jul 24 15:39:45 ha-node1 httpd[63101]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:5000
Jul 24 15:39:45 ha-node1 httpd[63101]: no listening sockets available, shutting down
Jul 24 15:39:45 ha-node1 httpd[63101]: AH00015: Unable to open logs
Jul 24 15:39:45 ha-node1 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 24 15:39:45 ha-node1 kill[63103]: kill: cannot find process ""
Jul 24 15:39:45 ha-node1 systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 24 15:39:45 ha-node1 systemd[1]: Failed to start The Apache HTTP Server.
Jul 24 15:39:45 ha-node1 systemd[1]: Unit httpd.service entered failed state.
Jul 24 15:39:45 ha-node1 systemd[1]: httpd.service failed.

我使用systemctl -xe

[root@ha-node1 keystone]# systemctl start httpd.service 
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
[root@ha-node1 keystone]# journalctl -xe 
Jul 24 15:42:50 ha-node1 xinetd[9502]: EXIT: mysqlchk status=0 pid=63631 duration=0(sec)
Jul 24 15:42:54 ha-node1 polkitd[844]: Registered Authentication Agent for unix-process:63642:16631197 (system bus name :1.134 [/usr/bin/pkttyagent --notif
Jul 24 15:42:54 ha-node1 systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit httpd.service has begun starting up.
Jul 24 15:42:54 ha-node1 httpd[63647]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:5000
Jul 24 15:42:54 ha-node1 httpd[63647]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:5000
Jul 24 15:42:54 ha-node1 httpd[63647]: no listening sockets available, shutting down
Jul 24 15:42:54 ha-node1 httpd[63647]: AH00015: Unable to open logs
Jul 24 15:42:54 ha-node1 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 24 15:42:54 ha-node1 kill[63649]: kill: cannot find process ""
Jul 24 15:42:54 ha-node1 systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 24 15:42:54 ha-node1 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit httpd.service has failed.
-- 
-- The result is failed.
Jul 24 15:42:54 ha-node1 systemd[1]: Unit httpd.service entered failed state.
Jul 24 15:42:54 ha-node1 systemd[1]: httpd.service failed.
Jul 24 15:42:54 ha-node1 polkitd[844]: Unregistered Authentication Agent for unix-process:63642:16631197 (system bus name :1.134, object path /org/freedesk
Jul 24 15:42:56 ha-node1 xinetd[9502]: START: mysqlchk pid=63654 from=::ffff:192.168.8.102
Jul 24 15:42:56 ha-node1 xinetd[9502]: EXIT: mysqlchk status=0 pid=63654 duration=0(sec)
Jul 24 15:43:04 ha-node1 xinetd[9502]: START: mysqlchk pid=63704 from=::ffff:192.168.8.101
Jul 24 15:43:04 ha-node1 xinetd[9502]: EXIT: mysqlchk signal=13 pid=63704 duration=0(sec)

我也试过这个命令:

[root@ha-node1 keystone]# ps aux | grep httpd
root      63271  0.0  0.0 112644   948 pts/0    S+   15:40   0:00 grep --color=auto httpd

[root@ha-node1 keystone]# systemctl list-unit-files | grep httpd
httpd.service                               disabled

[root@ha-node1 keystone]# netstat -ntlp | grep 5000 
tcp        0      0 45.117.40.168:5000      0.0.0.0:*               LISTEN      9677/haproxy        

1 个答案:

答案 0 :(得分:0)

最后,我在/etc/httpd/conf.d/wsgi-keystone.conf找到了,我听了5000和35357端口。所以我把它们改成了其他的端口:

Listen 5002
Listen 35358

<VirtualHost *:5002>
    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-public
    WSGIScriptAlias / /usr/bin/keystone-wsgi-public
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

    <Directory /usr/bin>
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:35358>
    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-admin
    WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

    <Directory /usr/bin>
        Require all granted
"/etc/httpd/conf.d/wsgi-keystone.conf" 32L, 1039C  

因为haproxy正在监听5000端口。