[Nova] nova-compute服务正常但状态Down

    xiaoxiao2022-07-15  149

    问题现象

    在下面这张图中我们可以看到有一个Compute是Down的。 这个时候的第一印象是Compute的挂掉了。但是检查的时候有时会发现Compute并没有挂掉,nova-compute服务也跑的好好的。

    问题分析

    这个情况基本上是由于时间不同步导致的。 在/etc/nova.conf中有如下配置,默认的service_down_time是60秒。

    # Maximum time since last check-in for up service (integer value) # service_down_time=60

    在nova.servicegroup.drivers.db中有如下处理用于判断服务的状态是up还是down的。

    class DbDriver(base.Driver): def __init__(self, *args, **kwargs): self.service_down_time = CONF.service_down_time ... def is_up(self, service_ref): """Moved from nova.utils Check whether a service is up based on last heartbeat. """ ... elapsed = timeutils.delta_seconds(last_heartbeat, timeutils.utcnow()) is_up = abs(elapsed) <= self.service_down_time ... ...

    从上可以看到,在默认的配置下,如果Compute比Controller慢了1分钟以上,那即使Controller能不断的收到Compute上报的信息。但还是会认为Compute是Down的。

    安装配置NTP

    安装
    yum install ntp ntpdate
    同步时间
    # Sync time with server ntpdate <server> # Set the Hardware Clock to the current System Time clock -w
    配置/etc/ntp.conf
    server <server> restrict 127.0.0.1 restrict -6 ::1 restrict <server> mask 255.255.255.255 nomodify notrap noquery driftfile /var/lib/ntp/drift includefile /etc/ntp/crypto/pw keys /etc/ntp/keys
    启动ntp服务
    systemctl start ntpd systemctl enable ntpd
    最新回复(0)