OpenStack专题:设置hostname并永久生效

OpenStack专题:设置hostname并永久生效

作者:BlogUpdater |  时间:2018-01-11 |  浏览:3917 |  评论已关闭 条评论

操作系统:CentOS 7.3 1611
OpenStack版本:Ocata

在单机部署OpenStack时,一开始的准备工作如果没有做好,很容易导致后面各个组件安装出现问题。今天要说的是这个hostname问题。
hostname为本机名,在OpenStack各个组件安装时需要将它写入到各个组件的配置文件中,如果hostname没有设置,则nova和neutron组件会将默认的localhost写入数据库中,导致各种数据不一致的问题。
使用以下方法可以永久性的设置本机hostname:
1) vi /etc/hosts
添加本机名和IP的对应条目,例如:
testserver 192.168.1.30
2) hostnamectl set-hostname testserver
3) reboot

完成以上设置并重启后,可以使用hostnamectl工具检查是否设置成功,如下所示:
[root@localhost ~]# hostnamectl
Static hostname: testserver
Icon name: computer
Chassis: n/a
Machine ID: xxx
Boot ID: xxx
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-123.el7.x86_64
Architecture: x86_64

标签:

评论已关闭。