Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] metadataServiceUri with multiple zk servers #1756

Closed
yongzhang opened this issue Oct 24, 2018 · 16 comments
Closed

[Question] metadataServiceUri with multiple zk servers #1756

yongzhang opened this issue Oct 24, 2018 · 16 comments

Comments

@yongzhang
Copy link

yongzhang commented Oct 24, 2018

Hi,

From the documents, I can see zkServers parameter has been deprecated in favor of using metadataServiceUri, but I can't see any example to define metadataServiceUri with multiple zk servers? Please help, thanks.

zk+hierarchical://localhost:2181/ledgers

Is it something like this?

zk+hierarchical://server1:2181/ledgers,zk+hierarchical://server2:2181/ledgers,zk+hierarchical://server3:2181/ledgers
@eolivelli
Copy link
Contributor

No, it should be like
zk://server2:port,server2:port/ledgers

@eolivelli
Copy link
Contributor

@hiscal2015 can you try with my suggested URI?

@yongzhang
Copy link
Author

@eolivelli Sorry for delay, looks format zk://server1:port,server2:port,server3:port/ledgers does not work,

I tried with zk+hierarchical://server1:2181/ledgers,zk+hierarchical://server2:2181/ledgers,zk+hierarchical://server3:2181/ledgers, it works fine, can you have a double check? Thanks a lot.

@eolivelli
Copy link
Contributor

This sounds to me as a big problem.
I have to performs trials and reproduce your case.
Are you using that config both on bookie and client?

@yongzhang
Copy link
Author

Looks like the setting is only available on bookie, client only needs webservice and broker url.

@eolivelli
Copy link
Contributor

@hiscal2015 metadataServiceUri is available on client as well.
Are you using directly a client or another application ?

@sijie
Copy link
Member

sijie commented Oct 29, 2018

@hiscal2015 hmm, I think ',' can not be used in a java URI. URI will take characters before ','. That might example why you see zk://server1:port,server2:port,server3:port/ledgers doesn't work and zk+hierarchical://server1:2181/ledgers,zk+hierarchical://server2:2181/ledgers,zk+hierarchical://server3:2181/ledgers works.

Can you try zk://server1:port;server2:port;server3:port/ledgers?

Looks like the setting is only available on bookie, client only needs webservice and broker url.

from pulsar's perspective, it is a setting for broker and bookies.

@eolivelli
Copy link
Contributor

In fact the code which translates from the legacy zkServer to the new model is

and it simply concatenates:

  • metadata protocol
  • list of zk servers
  • ledgers path

@sijie
Copy link
Member

sijie commented Oct 29, 2018

@eolivelli I think the question how current code extracts zk servers from metadata service uri. I know dlog uri handles ';' and converts it to ','. but I am not very sure about the new metadata service uri, have to look more into this.

@sijie
Copy link
Member

sijie commented Oct 30, 2018

@hiscal2015 any luck with zk://server1:port;server2:port;server3:port/ledgers?

@yongzhang
Copy link
Author

@sijie My cluster was destroyed days ago, I'll get it back to you once cluster coming back again.

@sijie
Copy link
Member

sijie commented Nov 1, 2018

@hiscal2015 cool thank you

@sijie
Copy link
Member

sijie commented Nov 10, 2018

@hiscal2015 I am closing this issue since the question is answered. If you still see the issue, please reopen it.

@sijie sijie closed this as completed Nov 10, 2018
@yongzhang
Copy link
Author

yongzhang commented Nov 28, 2018

@sijie @eolivelli

Today I changed metadataServiceUri to zk://server1:port;server2:port;server3:port/ledgers and see below logs:

Nov 28 15:08:46 bookkeeper[1105]: 2018-11-28 15:08:46,217 - INFO  - [main:ZKMetadataDriverBase@186] - Initialize zookeeper metadata driver at metadata service uri zk+hierarchical://10.10.100.17:2181;10.10.100.31:2181;10.10.100.27:2181/ledgers : zkServers = 10.10.100.17:2181,10.10.100.31:2181,10.10.100.27:2181, ledgersRootPath = /ledgers.

Is that means this is succeed?

@sijie
Copy link
Member

sijie commented Nov 28, 2018

@hiscal2015 yes that succeed

@ghost
Copy link

ghost commented Mar 3, 2020

Hi I can't get this to work..
I tried with different values, yet all i get is
14:13:07.675 [main] INFO org.apache.bookkeeper.meta.zk.ZKMetadataDriverBase - Initialize zookeeper metadata driver at metadata service uri zk+null://localhost:2181/ledgers : zkServers = lo Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss calhost:2181, ledgersRootPath = /ledgers.

here is how my bookie.conf looks like. can you please help me figure out the format..

#############################################################################
## ZooKeeper parameters
#############################################################################

# A list of one of more servers on which Zookeeper is running.
# The server list can be comma separated values, for example:
#zkServers=zk-0:2181,zk-1:2181,zk-2:2181
#zkServers=10.42.3.12:2181,10.42.4.8:2181,10.42.5.6:2181
#zkServers=localhost:2181
#metadataServiceUri=zk+hierarchical://zk-0:2181/ledgers,zk+hierarchical://zk-1:2181/ledgers,zk+hierarchical://zk-2:2181/ledgers
metadataServiceUri=zk+hierarchical://10.42.3.12:2181/ledgers,zk+hierarchical://10.42.4.8:2181/ledgers,zk+hierarchical://10.42.5.6:2181/ledgers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants