@Override
protected void doStart() throws ElasticSearchException {
Map<String, String> nodeAttributes = discoveryNodeService.buildAttributes();
// note, we rely on the fact that its a new id each time we start, see FD and "kill -9" handling
//String nodeId = UUID.randomBase64UUID();原来的方法,生成64位的uuid
InetSocketTransportAddress address = (InetSocketTransportAddress)transportService.info().getAddress().publishAddress();
String host = address.address().getAddress().getHostAddress().replace(".", "");//获得ip
int port = address.address().getPort();//获得端口
String nodeId = host + port;
localNode = new DiscoveryNode(settings.get("name"), nodeId, transportService.boundAddress().publishAddress(), nodeAttributes);
latestDiscoNodes = new DiscoveryNodes.Builder().put(localNode).localNodeId(localNode.id()).build();
nodesFD.updateNodes(latestDiscoNodes);
pingService.start();
// do the join on a different thread, the DiscoveryService waits for 30s anyhow till it is discovered
asyncJoinCluster();
}