database connection failed (Connection refused)

ovsdb-server /etc/openvswitch/conf.db /etc/openvswitch/hw_vtep.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/var/run/openvswitch/db.sock --remote=db:hardware_vtep,Global,managers --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir --log-file=/var/log/openvswitch/ovsdb-server.log --pidfile=/var/run/openvswitch/ovsdb-server.pid --detach --monitor
ovs-vsctl --no-wait init
ovs-vswitchd --log-file --detach --pidfile unix:/var/run/openvswitch/db.sock
[root@kunpeng82 ~]# ovs-vsctl show
ovs-vsctl: unix:/usr/local/var/run/openvswitch/db.sock: database connection failed (Connection refused)
[root@kunpeng82 ~]#
kill 不启动vtep
ovs-vswitchd --log-file --detach --pidfile unix:/var/run/openvswitch/db.sock
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock 
--remote=db:Open_vSwitch,Open_vSwitch,manager_options 
--private-key=db:Open_vSwitch,SSL,private_key 
--certificate=db:Open_vSwitch,SSL,certificate 
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --pidfile --detach

[root@kunpeng82 ~]# bash start_ovs.sh 
[root@kunpeng82 ~]# ovs-vsctl --no-wait init
[root@kunpeng82 ~]# ovs-vswitchd --log-file --detach --pidfile unix:/var/run/openvswitch/db.sock
disable ovs-vtepd
[root@kunpeng82 ~]# cat  /usr/lib/systemd/system/ovs-vtepd.service 
[Unit]
Description=Open vSwitch-based VTEP emulator
After=openvswitch.service
Requires=openvswitch.service

[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/openvswitch-vtep
ExecStart=/usr/share/openvswitch/scripts/ovs-vtep --log-file=/var/log/openvswitch/ovs-vtep.log --pidfile=/var/run/openvswitch/ovs-vtep.pid $VTEP_SWITCH_NAME

[root@kunpeng82 ~]# systemctl disable ovs-vtepd
[root@kunpeng82 ~]# 
原文地址:https://www.cnblogs.com/dream397/p/13301406.html