整理Linux搭建redis、zookeeper、kafka,自用

本文写的搭建地址教程,均转载其他博客(例:搭建redis集群:https://www.cnblogs.com/lihaoyang/p/6906444.html

netstat -anlp | grep 8005查询端口号

端口号:
Zookeeper端口号默认2181
es端口号默认9300,客户端口号9200
Kafka默认在9092端口上运行,并连接zookeeper的默认端口:2181    .\kafka-server-start.bat ..\config\server.properties(本地Windows启动)
redis 端口号默认6379

------------------------------------------------------
使用极光推送,必须开启80端口和443端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

vim /etc/hosts
配置极光的域名和ip
113.31.136.60 api.jpush.cn
183.232.57.12 api.jpush.cn

------------------------------------------------------

ES下载地址:https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.3.1.tar.gz
ES启动:./elasticsearch -d -Xms512m -Xmx512m

redis下载地址:http://download.redis.io/releases/redis-3.2.10.tar.gz
redis启动:./redis-server ../redis.conf

搭建redis集群:https://www.cnblogs.com/lihaoyang/p/6906444.html

创建集群
./redis-trib.rb  create --replicas  1  127.0.0.1:7001  127.0.0.1:7002  127.0.0.1:7003  127.0.0.1:7004  127.0.0.1:7005   127.0.0.1:7006

 

zookeeper下载地址:http://mirrors.hust.edu.cn/apache/zookeeper/
zookeeper启动:./zkServer.sh

(kafka搭建教程:启动生产者消费者:https://blog.csdn.net/qq_34409255/article/details/80392463)

集群:https://blog.csdn.net/weixin_42575806/article/details/80981743
kafka下载地址:http://kafka.apache.org/downloads.html
kafka启动:bin/kafka-server-start.sh -daemon ./config/server.properties 1>/dev/null 2>&1 &   守护进程
创建topic为test:bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
查看topic:          bin/kafka-topics.sh --list --zookeeper localhost:2181
删除topic:          bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic test2

打开topic为test的生产者:

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
bin/kafka-console-producer.sh --broker-list 192.168.0.117:9092,192.168.0.118:9092,192.168.0.119:9092 --topic test

接收topic为test的消费者:

0.90版本之前启动消费者bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
0.90版本之后启动消费者bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

 

你可能感兴趣的:(个人整理)