可以通过执行下面的代码来修改linux系统的hostid
#!/usr/bin/python
from struct import pack
hostid = pack("I",int("0x210a2500",16))
filename = "/etc/hostid"
open(filename,"wb").write(hostid)
210a2500为你要修改的hostid
执行完上面的代码后执行hostid进行检查
# hostid
210a2500
警告:以防万一最好事先备份/etc/hostid文件,如果没有则无需备份。