/
指定节点主机名

指定节点主机名

这是一个可选步骤,详细说明了如何指定节点主机名


描述指令
1

更新/ etc / hosts文件

    • 用您想要的主机名替换默认主机名
      • 默认主机名通常遵循“127.0.1.1”,不要替换“localhost”
      • 请参见粗体示例
      • 您可能需要像示例中那样禁用“manage_etc_hosts”
    • 使用CTRL + x保存并退出,然后键入y并按Enter键。


注意:在示例中,我使用“node01”作为主机名。 我使用与我的示例FQDN相同的主机名:

node01.zentest.win

sudo nano /etc/hosts


Example Output

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#......./etc/cloud/cloud.cfg or cloud-config from user-data

127.0.1.1 node01
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

2

升级/etc/hostname 文件

  • 用您想要的主机名替换现有的主机名
sudo nano /etc/hostname


Example Output

node01

3使用systemd服务设置主机名,将<HOSTNAME>替换为所需的主机名
sudo hostnamectl set-hostname <HOSTNAME>


Example Output

zenops@vps421337:~$ sudo hostnamectl set-hostname node01

4

重新引导节点并以非root用户身份重新登录,以测试主机名是否已更改

  • 您将在终端提示符下看到新的主机名
sudo reboot


Example Output

zenops@node01:~$



© 2019 Horizen. All rights reserved.


Related content

Especificar el Nombre del Host del Nodo
Especificar el Nombre del Host del Nodo
More like this
Specify Node Hostname
Specify Node Hostname
More like this
将安全节点迁移到超级节点
将安全节点迁移到超级节点
More like this
更改FQDN
更改FQDN
More like this
第11部分 - 重新启动和验证服务
第11部分 - 重新启动和验证服务
More like this
Change FQDN
Change FQDN
More like this