Find node in Zookeeper - apache-zookeeper

I want to know if there is a way to walk the Zookeeper's (ZK) in memory database and find if any particular node exists. Something similar to find . -name file inside ZK
I am logged in to ZK using zkCli.

Once you have your ZK cluster running, you can connect to a node and query the cluster.
For example:
$ZK_HOME/bin/zkCli.sh -server localhost
List of nodes:
ls /
List of commands:
?

Related

Where are Zookeeper files actually present?

I am currently working with SolrCloud and have set up Zookeeper on a server. To create a collection in SolrCloud, I upload a configset in Zookeeper and use it to create a collection. On the zookeeper server, I use Zookeeper's CLI to view the config files as follows: -
zk#ip-some-ip-some-ip:/opt/zookeeper/bin$ ./zkCli.sh -server 127.0.0.1:9983
/usr/bin/java
Connecting to 127.0.0.1:9983
[zk: 127.0.0.1:9983(CONNECTED) 0]
[zk: 127.0.0.1:9983(CONNECTED) 0] ls /configs
[_default, config_1, config_2]
[zk: 127.0.0.1:9983(CONNECTED) 1]
I tried searching for /configs directory within all zookeeper directories but couldn't find it. Where is it actually present on the system?
I tried searching for the configs directory as follows: -
find /var/zookeeper/ -name "configs"
find /opt/zookeeper/ -name "configs"
but didn't find anything.
I don't have any zookeeper directories anywhere else on the system.
Please let me know if any other information is needed from my end. Thank you for reading.
Zookeeper keeps its data in-memory. From the documentation,
Unlike a typical file system, which is designed for storage, ZooKeeper data is kept in-memory, which means ZooKeeper can acheive high throughput and low latency numbers.
Transaction logs are stored in Zookeeper's data directory

Failover cluster manager active node in powershell

I am trying to extract the cluster active node using powershell for data collection purpose. Firstly, does cluster active node and current host server refer to the same thing.
get-clustergroup -Name 'Cluster Group'|select *
I am using the above script to extract the owner node. Let me know if this correct way to proceed or is there any other script to follow up to get the active node in the cluster.
The following command will give you the active node for the cluster group directly:
(get-clustergroup -Name 'Cluster Group').ownernode.name

How to check whether a query is directed to node 1 or node 2 in postgres cluster configured with pgpool?

I have configured pgpool with 2 nodes Postgres in replication mode. I would like to check the functionality of load balancing. So, I want to know if there is a way to check which query is redirected to which node in Pgpool -II. Thanks
you can set "log_per_node_statement" parameter "on". it print the logs for each DB node separately.
http://www.pgpool.net/docs/latest/en/html/runtime-config-logging.html

MongoDB NonDocker and Docker Nodes

I have a 5 node MongoDB cluster installed non-Dockerized. I want to start adding nodes to this cluster but I want to use the Dockerized MongoDB (i.e. end result is to migrate Dockerized into the replica set and decommission the non-Dockerized nodes.)
When I do this, I am currently getting my added nodes stuck in STARTUP status so from my understanding the config files are not able to sync up.
Is there something that I need to do to prepare the cluster for the new nodes or is there some logs that I can delve into to find out why it is not moving to STARTUP2?
The data directory was not large enough thus the config files were unable to sync. As soon as I grew the data directory - all was well.

Dynamic construction of zookeeper cluster

I'd like to programatically setup zookeeper cluster. My goal is to use machines with CoreOS and dynamically deploy three nodes in form of docker containers and setup them to one zoo cluster.
Except common setup in manual (/zookeeperReconfig.html) which shows how to add another nodes to existing three nodes cluster, I found a conversation which say how to do that from the beginning when I have no running nodes in existing cluster. Unfortunately, this set of steps does not work for me. I'm talking about http://mail-archives.apache.org/mod_mbox/zookeeper-user/201408.mbox/%3CCAPSuxQipZFH2582bEMid2tCVBFk%3DC31hwCYjbFgSwChBF%2BZQVQ%40mail.gmail.com%3E
Here is a list of steps I did:
Run first node with standaloneEnabled=false and the only entry in zoo.cfg.dynamic.
server.1=localhost:2381:2281:participant;0.0.0.0:2181
Run second node with following dynamic cfg:
server.1=localhost:2381:2281:participant;0.0.0.0:2181
server.2=localhost:2382:2282:observer;0.0.0.0:2182
Note that there is no difference in resulting behavior when I'd change "observer" to "participant" for second node.
Now I have two running instances. I can use ./zkCli.sh to log into first node. When I try to add second node using following command:
reconfig -add server.2=localhost:2382:2282:participant;0.0.0.0:2182
... it fails with:
KeeperErrorCode = NewConfigNoQuorum for
However, after some research I found solution. But it's tricky and I don't think that it's the only correct solution.
What is working for me? I can do step #3 on first node again but now with "observer". This command causes that even first node knows about second node. When I type 'config' to console in zkCli, it seems that it's working. Next step is to log into second node using zkCli and than exec commands:
reconfig -remove 2 <- next step is not working w/o this
reconfig -add server.2=localhost:2382:2282:participant;0.0.0.0:2182
Well, now I have working cluster for two nodes. Finally, it's interesting that now I can add third node using regular scenario I've mentioned in first paragraph.
Do someone have some idea what I'm doing wrong?