GitHub user maoling opened a pull request: https://github.com/apache/zookeeper/pull/624
ZOOKEEPER-3108:use a new property server.id in the zoo.cfg to substitute for myid file - use a new property `server.id` in the `zoo.cfg` to substitute for `myid `file,If the unique id is both set in the `server.id` of `zoo.cfg` and `myid` file,the `server.id` has the priority. - I had tested this patch in my docker in standalone and qurom mode with mixed `myid` file and the `server.id` it has no intrude,totally backwards compatibility,branch3.4 can still use myid file, but branch 3.5+, suggest to use `server.id `in the zoo.cfg - the related UTs `ZooKeeperServerMainTest.testStandalone()` and `QuorumPeerMainTest.testQuorum() `have passed,before reviewing,let's listen to the QA report in case of something I miss - more details and disscusion in [ZOOKEEPER-3108](https://issues.apache.org/jira/browse/ZOOKEEPER-3108) - Let me list why this is needed: **1.** put the `myid` which's about the conf of server in the `dataDir` is not a good idea.if I want to `rm -rf `the data in this directory manually,I will delete the `myid` file by mistake. **2.** conf like this will be easy-to-read,and tell me who I am just like `kafka` does. ``` server.id = 2 ---*******--- server.1=172.17.0.2:2888:3888 server.2=172.17.0.2:12888:13888 server.3=172.17.0.2:22888:23888 ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/maoling/zookeeper ZOOKEEPER-3108 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/zookeeper/pull/624.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #624 ---- commit af2a12c6e4037cf0010ea15c43355ec4f5ea4318 Author: maoling <maoling199210191@...> Date: 2018-09-05T08:44:54Z ZOOKEEPER-3108:use a new property server.id in the zoo.cfg to substitute for myid file ---- ---