Maven, Redis, and Kafka installation and configuration

Maven installation and configuration ...
1, Download and install
2, Custom storage directory
3, Environment variable configuration
4, Check whether the installation is successful through the DOS command
1, Download installation package
2, Environment variable configuration
3, Start the server and client
4, Is the verification successful
Zookeeper configuration
Maven installation and configuration

1, Download and install

go to https://Download the latest version of Maven at maven.apache.org/download.cgi

2, Custom storage directory

Extract the file to D:\Program Files\Apache\maven directory

3, Environment variable configuration

  1. New environment variable MAVEN_HOME, assignment D:\Program Files\Apache\maven


2. Edit the environment variable Path and add% MAVEN_HOME%\bin

4, Check whether the installation is successful through the DOS command

redis installation and deployment

1, Download installation package

  1. official https://redis.io/download Download address
    Windows is not supported (but Redis project does not officially support windows. However, Microsoft open technology team develops and maintains this windows port for Win64)
  2. Windows download address (Microsoft's GitHub address)
https://github.com/MSOpenTech/redis/releases

2, Environment variable configuration

3, Start the server and client

  1. Method 1: in the directory, double-click redis-server.exe to start the service, and then double-click redis-cli.exe to start the client

  2. Method 2: copy a redis.windows.conf file to the DOS command user, enter redis-server.exe redis.windows.conf in cmd to start the service

4, Is the verification successful

  1. After the server is started successfully, there is no need to close it. Reopen a cmd window and enter the redis-cli.exe -h 127.0.0.1 -p 6379 command
  2. Enter the command set myKey abc
  3. Enter the command get myKey
Kafka installation and configuration

To install Kafka, you need to install Zookeeper first

Zookeeper configuration

1, Install java jdk and configure environment variables

2, Download and configure Zookeeper

  1. Download the installation package: http://zookeeper.apache.org/releases.html#download
  2. Unzip and enter the ZooKeeper directory, such as D:\Kafka\zookeeper-3.4.9\conf
  3. Rename "zoo_sample.cfg" to "zoo.cfg"
  4. Open "zoo.cfg" to find and edit dataDir = D: \ Kafka \ zookeeper-3.4.9 \ TMP (must be separated by \)
  5. Add system variable: ZOOKEEPER_HOME=D:\Kafka\zookeeper-3.4.9
  6. Edit the path system variable and add the path:% ZOOKEEPER_HOME%\bin
  7. Modify the default Zookeeper port (default port 2181) in the zoo.cfg file
  8. Open a new cmd, enter "zkServer" and run Zookeeper
  9. There may be a startup error prompt "ZooKeeper audit is disabled" when running due to version problems
  10. Add "- Dzookeeper.audit.enable=true" in zkServer.cmd configuration file
  11. The command line prompts "ZooKeeper audit is enabled" as follows: it indicates that the local Zookeeper is started successfully
  12. Note: do not close the ZooKeeper startup window

Kafka installation and configuration

  1. Download Kafka package download address

https://archive.apache.org/dist/kafka/

  1. Unzip and enter the Kafka directory, find the config directory, and open the file server.properties
  2. Locate and edit the log.dirs path

log.dirs=D:\Program Files\kafka\kafka-logs

  1. Edit service port
zookeeper.connect=localhost:2181


5. Execute the command to start kafka service

.\bin\windows\kafka-server-start.bat .\config\server.properties
  1. Startup error message:
ERROR Disk error while writing log start offsets checkpoint in directory

It's been a long time. The root cause is that the version installation is too high. I installed kafka_2.12-3.0.0 changed to kafka_2.12-3.8.0 like other configuration methods, execute the command again successfully

.\bin\windows\kafka-server-start.bat .\config\server.properties


7. Create a topic named test and enter the command

.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test


8. The query subject input command is as follows:

.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181


9. Create a producer and enter a command

.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test
input: Pytest


10. Create a consumer and enter a command

.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
  1. Write messages to the producer window, and the consumer window can also receive messages synchronously
  2. Query topic configuration information
.\bin\windows\kafka-topics.bat --describe --zookeeper localhost:2181 --topic test

Kafka installation configuration summary

  1. Open a new cmd and enter "zkServer" to start the zookeeper service without shutting it down
  2. kafka service starts without closing the page
.\bin\windows\kafka-server-start.bat .\config\server.properties


3. Create topic test topic kafka, and do not close the page successfully

.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic Pytest


4. Query subject input command

.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181


5. Create a producer and generate a message without closing the page

.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic Pytest


6. Create a consumer to receive messages without closing the page

.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic Pytest --from-beginning


7. The producer sends the information again and synchronizes it to the consumer

8. Query topic configuration information

.\bin\windows\kafka-topics.bat --describe --zookeeper localhost:2181 --topic Pytest


9. Two topics are found

.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181


10. Deleting the topic test is only marked for deletion

.\bin\windows\kafka-topics.bat kafka.admin.DeleteTopicCommand --zookeeper localhost:2181 --delete --topic test

29 November 2021, 03:57 | Views: 8988

Add new comment

For adding a comment, please log in
or create account

0 comments