2016-03-03 121 views
1

在我的谷歌云计算引擎中,/ etc/hosts文件在一段时间后会自动覆盖。谷歌云计算引擎/ etc/hosts

请向我建议为什么发生这种情况,以及如何预防它。

最初条目如下:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 

::1   localhost localhost.localdomain localhost6 localhost6.localdomain6 

10.128.0.2 instance-1.c.concrete-craft-123421.internal instance-1 # Added by Google 

,我已经把它改成如下开始Cloudera的服务。

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 

::1   localhost localhost.localdomain localhost6 localhost6.localdomain6 

#10.128.0.2 instance-1.c.concrete-craft-123421.internal instance-1 # Added by Google 

10.128.0.2 instance-1 instance-1 

但是过了一段时间后,原来的条目会重新出现。任何想法是什么造成这个?

感谢,
南大

回答

0

在谷歌Compute Engine执行个体有Google-daemons它在后台运行。这些守护进程服务负责以下服务:

1. Creates new accounts based on the instance metadata. 
2. Configures SSH to accept the accounts' public keys from the instance metadata. 
3. Adds IP addresses of network load balancers as aliases of the external Ethernet interface 
4. Resyncs clock if skewed due to live migration 

/etc/hosts由这些守护程序服务进行管理和覆盖。因此,如果您想永久更改实例的主机名,您可以通过在实例上创建一个cron作业来实现。你可以通过这个video,它有创建一个cron作业的步骤。

1

你可以做这个

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 

::1   localhost localhost.localdomain localhost6 localhost6.localdomain6 

#10.128.0.2 instance-1.c.concrete-craft-123421.internal instance-1 # Added by Google 

10.128.0.2 instance-1 instance-1 

什么,而不是谷歌的前行太添加一行

10.128.0.2 instance-1 instance-1 

。并且不需要有cron;)它不会被删除!

做这样的 - >

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 

::1   localhost localhost.localdomain localhost6 localhost6.localdomain6 

10.128.0.2 instance-1 instance-1 

#10.128.0.2 instance-1.c.concrete-craft-123421.internal instance-1 # Added by Google