Build a pulsar cluster using pulsar-2.6.3. The first two bookies are OK for the first time, but the following errors are reported when starting the last bookie:
17:26:24.531 [main] ERROR org.apache.bookkeeper.server.Main – Failed to build bookie server
org.apache.bookkeeper.bookie.BookieException$InvalidCookieException:
at org.apache.bookkeeper.bookie.Bookie.checkEnvironmentWithStorageExpansion(Bookie.java:471) ~[org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.bookie.Bookie.checkEnvironment(Bookie.java:253) ~[org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.bookie.Bookie.< init> (Bookie.java:699) ~[org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.proto.BookieServer.newBookie(BookieServer.java:140) ~[org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.proto.BookieServer.< init> (BookieServer.java:108) ~[org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.server.service.BookieService.< init> (BookieService.java:52) ~[org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.server.Main.buildBookieServer(Main.java:313) ~[org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.server.Main.doMain(Main.java:226) [org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.server.Main.main(Main.java:208) [org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
at org.apache.bookkeeper.proto.BookieServer.main(BookieServer.java:317) [org.apache.bookkeeper-bookkeeper-server-4.11.1.jar:4.11.1]
Finally find the cause of the problem:
The advertiseddaddress in bookkeeper.conf of the last node is configured incorrectly and is configured as the address of the server where other bookies are located (because the package of pulsar is copy, the configuration item is forgotten to be changed), and the advertiseddaddress is changed
After correction, start again and succeed.
Further reason: after each bookie is started for the first time, it will register its own information with zookeeper. A new node will be generated in the/ledgers/books/directory, and the node name will be named with $(bookie_ip): $(bookie_port),
Node data includes bookiehost, journaldir, ledgerdirs, instanceid and other information. At the same time, a current directory will be generated under the data directory of bookie, including journal and ledger, and a new version will be created under this directory
The contents of the file are consistent with the data of the/ledgers/books/$(bookie_ip): $(bookie_port) node in zookeeper. If the data stored in the version file of bookie itself is different from that stored in the corresponding node of zookeeper
Consistent, an illegal cookie error will be reported when starting the bookie.
Looking back, because the IP of my last bookie node is configured as the IP of other bookies, it is found that the corresponding node on zookeeper already exists at startup (the path has been registered by the previous bookie node). At this time
It is considered that the bookie is a registered node, and the cookie of the bookie needs to be verified. In fact, the version file of the bookie has not been generated. Where does the cookie information come from, so the exception of invalidcookie exception is reported
Wrong.
The above may only be one of the reasons for the invalidcookieexception. If you encounter the same problem, you can solve it according to this idea. I hope it can help you.