汇总Hadoop Hive ZooKeeper HBase Kafka等常见命令
Hadoop命令
# Hadoop一键启动命令 # 启动HDFS start-dfs.sh # 启动Yarn start-yarn.sh # 启动历史任务服务进程 mr-jobhistory-daemon.sh start historyserver # 快速重启和停止 stop-all.sh start-all.sh # 停止集群 stop-dfs.sh stop-yarn.sh mr-jobhistory-daemon.sh stop historyserver Hive命令 # 首先启动metastore服务,然后启动hiveserver2服务 nohup /export/server/hive-2.1.0/bin/hive --service metastore & nohup /export/server/hive-2.1.0/bin/hive --service hiveserver2 & # 一键启动脚本 expect /export/server/beenline.exp set hive.exec.mode.local.auto=true; --开启本地mr ZooKeeper命令 # 开启zk zkServer.sh start # 关闭zk zkServer.sh stop # 查看zk状态 zkServer.sh status HBase命令 # 单节点启动 start-hbase.sh # 关闭 stop-hbase.sh # 单独启动节点(高可用启用) hbase-daemon.sh start master hbase-daemon.sh start regionserver 关闭 hbase-daemon.sh stop regionserve hbase-daemon.sh stop master # HBase客户端进入 hbase shell # 开启phoenix客户端 cd /export/server/apache-phoenix-5.0.0-HBase-2.0-bin/ bin/sqlline.py node1:2181
Kafka命令
# kafka开启 cd /export/server/kafka_2.12-2.4.1/bin ./kafka-server-start.sh ../config/server.properties # 一键集群开启 cd /export/onekey start-kafka.sh # 开启 stop-kafka.sh # 关闭 # 常用案例 ./kafka-topics.sh --create --zookeeper node1:2181,node2:2181,node3:2181 --topic test01 --partitions 3 --replication-factor 3 ./kafka-topics.sh --alter --zookeeper node1:2181,node2:2181,node3:2181 --topic test02 --partitions 6 ./kafka-topics.sh --list --zookeeper node1:2181,node2:2181,node3:2181 ./kafka-topics.sh --describe --zookeeper node1:2181,node2:2181,node3:2181 --topic test01 ./kafka-console-producer.sh --broker-list node1:9092,node2:9092,node3:9092 --topic test02 ./kafka-console-consumer.sh --bootstrap-server node1:9092,node2:9092,node3:9092 --topic test02 ./kafka-topics.sh --zookeeper node1:2181,node2:2181,node3:2181 --create --topic benchmark --partitions 1 --replication-factor 1