Skip to content

Instantly share code, notes, and snippets.

docker run -p 2181:2181 -v /path/to/my/conf:/opt/zookeeper/conf my/zookeeper
@iocanel
iocanel / gist:417999972f7eb4427e7a
Created October 27, 2014 14:36
ZooKeeper Ensemble Configuration
server.1=server1.example.com:2888:3888
server.2=server2.example.com:2888:3888
server.3=server3.example.com:2888:3888
...
server.current=[bind address]:[peer binding port]:[election biding port]
@iocanel
iocanel / gist:05ab0549b50f612058ed
Created October 27, 2014 14:47
A bash script to create ensemble config out of environment variables
if [ ! -z "$SERVER_ID" ]; then
echo "$SERVER_ID" > /opt/zookeeper/data/myid
#Find the servers exposed in env.
for i in `echo {1..15}`;do
HOST=`envValue ZK_PEER_${i}_SERVICE_HOST`
PEER=`envValue ZK_PEER_${i}_SERVICE_PORT`
ELECTION=`envValue ZK_ELECTION_${i}_SERVICE_PORT`
if [ "$SERVER_ID" = "$i" ];then
@iocanel
iocanel / gist:6234b8043bc0d76d82a5
Created October 27, 2014 15:11
A ZooKeeper container definition
{
"image": "fabric8/zookeeper",
"name": "zookeeper-server-1",
"env": [
{
"name": "ZK_SERVER_ID",
"value": "1"
}
],
"ports": [
@iocanel
iocanel / gist:bf0caf96914119e46c0d
Created October 27, 2014 15:32
ZooKeeper pod labeling
"labels": {
"name": "zookeeper-pod",
"server": 1
}
@iocanel
iocanel / gist:60170ee21fa8554a78bd
Last active August 29, 2015 14:08
ZooKeeper Server 1 Peer Service
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"id": "zk-peer-1",
"kind": "Service",
"port": 2888,
"containerPort": "zookeeper-peer-port",
"selector": {
"name": "zookeeper-pod",
"server": 1
@iocanel
iocanel / gist:c3e8b27b0e4fc956b19d
Created October 27, 2014 15:48
ZooKeeper client Service
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"id": "zk-client",
"kind": "Service",
"port": 2181,
"createExternalLoadBalancer": "true",
"containerPort": "zookeeper-client-port",
"selector": {
"name": "zookeeper-pod"
@iocanel
iocanel / gist:87a2676851d3a6c982f1
Last active August 29, 2015 14:09
EnsembleTracker and DynamicEnsembleProvider?
//Create the ensemble provider and feed the initial string
DynamicEnsembleProvider dynamicEnsembleProvider = new DynamicEnsembleProvider(cluster.getConnectString());
CuratorFramework client = CuratorFrameworkFactory.builder()
.ensembleProvider(dynamicEnsembleProvider)
.retryPolicy(new RetryOneTime(1000))
.build();
client.start();
client.blockUntilConnected();
@iocanel
iocanel / gist:3316c093304d5441c2f8
Created December 18, 2014 14:33
A sample fabric8/k8 arquillian test
package io.fabric8.apps.jenkins;
import io.fabric8.arquillian.kubernetes.Constants;
import io.fabric8.arquillian.kubernetes.Session;
import io.fabric8.kubernetes.api.KubernetesClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.junit.Test;
import org.junit.runner.RunWith;
Service: http://172.30.17.76:8080 is not ready! Error: Operation timed out
Service: http://172.30.17.149:11222 is ready
Service: http://172.30.17.218:11211 is ready
Service: http://172.30.17.123:9990 is ready
Service: http://172.30.17.149:11222 is ready
Service: http://172.30.17.218:11211 is ready
Service: http://172.30.17.123:9990 is ready
Service: http://172.30.17.76:8080 is not ready! Error: Operation timed out
Service: http://172.30.17.123:9990 is ready
Service: http://172.30.17.76:8080 is not ready! Error: Operation timed out