Difference between revisions of "Linux zookeeper"
From John Freier
| Line 16: | Line 16: | ||
== Spring Cloud ZooKeeper == | == Spring Cloud ZooKeeper == | ||
This framework helps manage the clients that connect to zookeeper. You can also use this for sharing values amongst a cluster. | This framework helps manage the clients that connect to zookeeper. You can also use this for sharing values amongst a cluster. | ||
| + | |||
| + | To start | ||
| + | |||
| + | package com.example.zookeeper.zkexample; | ||
| + | |||
| + | import org.springframework.boot.SpringApplication; | ||
| + | import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| + | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||
| + | import org.springframework.web.bind.annotation.RequestMapping; | ||
| + | import org.springframework.web.bind.annotation.RestController; | ||
| + | |||
| + | @SpringBootApplication | ||
| + | @EnableDiscoveryClient | ||
| + | @RestController | ||
| + | public class ZkExampleApplication { | ||
| + | |||
| + | @RequestMapping("/") | ||
| + | public String hello() { | ||
| + | return "hello"; | ||
| + | } | ||
| + | |||
| + | public static void main(String[] args) { | ||
| + | SpringApplication.run(ZkExampleApplication.class, args); | ||
| + | } | ||
| + | |||
| + | } | ||
| + | |||
| + | |||
| + | |||
== Resources == | == Resources == | ||
https://zookeeper.apache.org/doc/r3.3.3/zookeeperStarted.html | https://zookeeper.apache.org/doc/r3.3.3/zookeeperStarted.html | ||
https://cloud.spring.io/spring-cloud-zookeeper/ | https://cloud.spring.io/spring-cloud-zookeeper/ | ||
Revision as of 11:23, 18 July 2017
ZooKeeper is a cluster operator that stores values to be shared across multiply clients.
Shell Commands
The server works by using things called znodes, kind of like a file system /
This shell is very helpful for debugging issue and understand what Zoo Keeper does under the hood.
To Start the shell
./zkCli.sh -server localhost:2181
ls - list out the directory create /test - creates the znode test get /test - gets the data for the znode
Spring Cloud ZooKeeper
This framework helps manage the clients that connect to zookeeper. You can also use this for sharing values amongst a cluster.
To start
package com.example.zookeeper.zkexample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class ZkExampleApplication {
@RequestMapping("/")
public String hello() {
return "hello";
}
public static void main(String[] args) {
SpringApplication.run(ZkExampleApplication.class, args);
}
}
Resources
https://zookeeper.apache.org/doc/r3.3.3/zookeeperStarted.html https://cloud.spring.io/spring-cloud-zookeeper/