前言:近期学习大数据离线数仓,接触到了许多处理数据的应用及工具:Hadoop、hive、sqoop、azkaban、flume、datax、superset、zookeeper、Kafka、redis等,做项目需要开启节点、启动服务,结束关掉服务节点等操作,这里将我常用的进行总结,以便随时查看。后期接触更多则继续在这里更新#离线数仓各工具常用命令及操作!二更
shutdown -h now
ntpdate -u ntp.api.bz
start-all.sh
stop-all.sh
hive
hive --service metastore &
hiveserver2
HQL
show functions;
desc function xxx;
set hive.exec.mode.local.auto=true;
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
sqoop import --connect jdbc:mysql://192.168.109.101:3306/test_db \
--username root --password 123456 \
--table tname \
--target-dir hdfs://192.168.109.101:9820/sqoopdata/tname \
--delete-target-dir
sqoop import \
--connect jdbc:mysql://192.168.109.101:3306/dbname \
--username root --password 123456 \
--hive-import --hive-database hdbname \
--hive-table tname \
--query "select * from t1 where \$CONDITIONS" \
--target-dir hdfs文件路径 \
--delete-target-dir -m 1
...exec-server]# ./bin/start-exec.sh #三台 先起
...web-server]# ./bin/start-web.sh
...flume]# flume-ng agent -n a1 -c conf -f $FLUME_HOME/conf/confname.conf -Dflume.root.logger=INFO,console
...datax]# ./bin/datax.py job/first.json
~]# source activate
(base)...~]# conda activate superset
(superset)...~]# gunicorn -w 1 -t 120 -b 192.168.109.101:8787 "superset.app:create_app()"
停掉gunicorn进程
ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | xargs kill -9
退出Superset环境
conda deactivate
mysql://root:[email protected]/dbname?charset=utf8
zkServer.sh start #启动
status #状态
启动kafka服务:先保证已经启动Zookeeper集群
...kafka]# /usr/local/kafka-2.4.1/bin/kafka-server-start.sh -daemon config/server.properties
...kafka]# zkCli.sh
...kafka]# kafka-topics.sh --create \ ##创建topic
--topic hadoop \ ## 指定要创建的topic的名称
--zookeeper 192.168.109.101:2181,192.168.109.102:2181,192.168.109.103:2181/kafka \ ##指定kafka关联的zk地址
--partitions 3 \ ##指定该topic的分区个数
--replication-factor 3 ##指定副本因子
----------------------------------------------------------------
----------------------------------------------------------------
...kafka]# kafka-topics.sh --list \ ##查看topic
--zookeeper 192.168.109.101:2181,192.168.109.102:2181,192.168.109.103:2181/kafka
-------------------------------------------------------------------
------------------------------------------------------------------
...kafka]# kafka-topics.sh --describe \ ##查看topic信息
--topic hadoop \
--zookeeper 192.168.109.101:2181,192.168.109.102:2181,192.168.109.103:2181/kafka
---------------------------------------------------------------------
----------------------------------------------------------------------
...kafka]# kafka-topics.sh --alter \ ##修改topic
--topic hadoop \
--zookeeper 192.168.109.101:2181,192.168.109.102:2181,192.168.109.103:2181/kafka \
--partitions 4
------------------------------------------------------------------
--------------------------------------------------------------------
...kafka]# kafka-topics.sh --delete \ ##删除topic
--topic hadoop \
--zookeeper 192.168.109.101:2181,192.168.109.102:2181,192.168.109.103:2181/kafka
-----------------------------------------------------------------
-----------------------------------------------------------------
...data]# kafka-console-producer.sh \
--topic hadoop \
--broker-list 192.168.109.101:9092,192.168.109.102:9092,192.168.109.103:9092
...~]# kafka-console-consumer.sh \
--topic hadoop \
--bootstrap-server 192.168.109.101:9092,192.168.109.102:9092,192.168.109.103:9092
--from-beginning
启动flume-agent
...~]# telnet 192.168.109.101 port ##port:confname.conf文件中设置的端口号
[zk:localhost:2181(CONNECTID)1] ls /kafka/brokers/topics
ke.sh start #启动Kafka Eagle
ke.sh stop #停止Kafka Eagle
ke.sh restart #重启Kafka Eagle
ke.sh status #查看Kafka Eagle系统状态
ke.sh stats #统计资源
ke.sh find [ClassName] #查看Kafka Eagle系统中的类是否存在
...redis]# src/redis-server redis.conf
修改redis.conf文件
...redis]# src/redis-server redis.conf
...redis]# ps -ef | grep redis
kill -9 pid
...redis]# src/redis-cli -h 192.168.109.101 -p 6379 -a 123
...redis]# src/redis-cli -h 192.168.109.101 -p 6379 -a 123
192.168.10.101:6379[1]> select 0
...cluster]# /usr/local/redis-3.0.6/src/redis-server 7001/redis.conf
redis-cli -c -h 192.168.109.101 -p 7001
sudo openresty -p /opt/app/collect-app/
/opt/soft/frp/frpc http --sd chlinrei -l 8802 -s frp.qfbigdata.com:7001 -u chlinrei
tail -f /opt/app/collect-app/logs/collect-app.access.log
systemctl start supervisord
systemctl stop supervisord
systemctl status supervisord
supervisorctl start xxx
hive --service metastore &
/opt/soft/presto/presto-sever/bin/launcher start / stop
presto --server 192.168.109.101:9080 --catalog hive --schema dbname
...presto-server]# vi /data/presto/data/var/log/server.log
show schemas;
按键Q
按键N或者Z
回车