Getting Started - wuyichen24/spring-microservices-in-action GitHub Wiki
Overview
Install Apache ZooKeeper
Step 1: Verify Java Installation
Use this command to verify the Java environment
java -version
Step 2: Install ZooKeeper
Step 2.1: Download ZooKeeper
Use this link for downloading the latest version of ZooKeeper.
Step 2.2: Extract the tar file
tar -zxf zookeeper-3.4.14.tar.gz
cd zookeeper-3.4.14
Step 2.3: Create a directory for data
Create a directory for storing the snapshot
mkdir data
Step 2.4: Create configuration file
Create zoo.cfg under the conf directory:
nano conf/zoo.cfg
Set the content of zoo.cfg:
tickTime = 2000
dataDir = /Users/wuyichen/zookeeper-3.4.14/data (Change this path for your case, see Step 2.3)
clientPort = 2181
initLimit = 5
syncLimit = 2
Step 2.5: Start ZooKeeper server
sh bin/zkServer.sh start
After executing this command, you should see the following message:
ZooKeeper JMX enabled by default
Using config: /Users/wuyichen/zookeeper-3.4.14/bin/../conf/zoo.cfg
-n Starting zookeeper ...
STARTED
Other useful command
- Start ZooKeeper client:
sh bin/zkCli.sh
- Stop ZooKeeper server:
sh bin/zkServer.sh stop
- Check ZooKeeper server status:
sh bin/zkServer.sh status
Install Apache Kafka
Step 1: Verify Java Installation
Use this command to verify the Java environment
java -version
Step 2: Install ZooKeeper
ZooKeeper is the prerequisite for Kafka, you need to install it before running Kafka.
Step 3: Install Kafka
Step 3.1: Download Kafka
Use this link for downloading the latest version of Kafka. Use the binary downloads like "kafka_a.b-x.y.z.tgz".
Step 3.2: Extract the tar file
tar -zxf kafka_2.11-2.2.0.tar.gz
cd kafka_2.11-2.2.0
Step 3.3: Start Kafka server
sh bin/kafka-server-start.sh config/server.properties
NOTE: Please make sure the ZooKeeper server is running also.
Install Redis
Step 4.1: Download Redis
If you are using Mac Terminal, you should use this command to download the latest stable Redis version.
curl http://download.redis.io/redis-stable.tar.gz -o redis-stable.tar.gz
If You are using Linux, you should use this command to download the latest stable Redis version.
wget http://download.redis.io/redis-stable.tar.gz
Step 4.2: Unzip and compile Redis
tar xvzf redis-stable.tar.gz
cd redis-stable
make
Step 4.3: Verify the build of Redis
make test
Step 4.4: Install Redis to your machine
This command will copy both the Redis server and the command line interface into /usr/local/bin/
.
sudo make install
Step 4.5: Start Redis server
If /usr/local/bin
is in your PATH
environment variable, you can run the following command to start your Redis server.
redis-server
Step 4.6: Verify your installation
Use the ping command to verify your installation.
redis-cli ping
If it responses
PONG
It means that your installation is successful.
Other useful command
- Enter the Redis command line interface:
redis-cli
.