• 大数据常用启动命令


    一、大数据集群:

    1、zookeeper集群操作:

    启动:bin/zkServer.sh start 【依次在hadoop102、hadoop103、hadoop104节点上启动zookeeper】

    关闭:bin/zkServer.sh stop

    查看状态:bin/zkServer.sh status

    服务端口号:2181

    2、Kafka集群操作(需先启动zookeeper):

    启动:bin/kafka-server-start.sh -daemon config/server.properties 【依次在hadoop102、hadoop103、hadoop104节点上启动kafka】

    关闭:bin/kafka-server-stop.sh

    创建topic:bin/kafka-console-producer.sh --broker-list hadoop102:9092 --topic recommender

    查看topic信息:bin/kafka-topics.sh --zookeeper localhost:2181 --list

    服务端口号:9092

    3、hadoop集群操作:

    格式化namenode:hadoop namenode -format

    hdfs启动:sbin/start-dfs.sh 【在hadoop102节点启动】

    yarn启动:sbin/start-yarn.sh【在hadoop103节点启动】

    hdfs访问地址:http://hadoop102:50070/explorer.html#/

    yarn访问地址:http://hadoop103:8088/cluster

    4、Hbase集群操作【前提zookeeper、hadoop正常部署】

    集群时间同步:ntpdate 0.cn.pool.ntp.org

    启动:bin/start-hbase.sh

    停止:bin/stop-hbase.sh

    查看Hbase页面:http://hadoop102:16010

     Hbase常用命令:

    进入HBase客户端: bin/hbase shell
    查看当前数据库中有哪些表: list
    创建表:create 'student','info'
    插入数据到表:put 'student','1001','info:sex','male'
    查看表数据:scan 'student'
    指定行”或“指定列族: get 'student','1001','info:name'
    查看表结构: describe 'student',
    删除某rowkey的某一列数据: delete 'student','1002','info:sex'
    删除表:先 disable 'student', 再drop 'student'
    变更表信息(将info列族中的数据存放3个版本:):alter 'student',{NAME=>'info',VERSIONS=>3}

    5、spark集群操作:

    启动:sbin/start-all.sh【在hadoop102节点启动】

    查看spark页面:http://hadoop102:8080/ 

    5、hive常见操作(首先启动hadoop集群):

    创建数据库并指定在hdfs上存放的位置:create database db_hive2 location'/db_hive2.db';

    若报错:FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)

    设置mysql数据集格式:mysql>  set global binlog_format='MIXED'; 

    进入hive客户端:bin/hive
    查看数据库:show databases;
    打开数据库:use default;
    查看数据库中的表:show tables;
    创建表:create table student(id int, name string) ;
    查看表结构:desc student;
    插入数据: insert into student values(1000,"ss");
    查询表中数据:select * from student;
    退出:quit;

     二、数据操作

    1、redis操作(设置了密码):

    redis默认安装位置:/usr/local/bin

    redis.conf配置:

    bind 192.168.1.102 #绑定主机IP

    requirepass 123456 #密码

    远程服务器执行命令:redis-cli –h IP地址 –p 端口 –a 密码

    启动:redis-server /myredis/redis.conf

    连接:redis-cli -p 6379 -a 123456

    关闭:redis-cli -p 6379 -a 123456 shutdown

    redis命令:

    lpush userId:4867 231449:3.0

    lrange userId:4867 0 -1

    2、mongodb操作:

    启动:mongod -config /opt/module/mongodb-3.4.3/data/mongodb.conf

    关闭:mongod -shutdown -config /opt/module/mongodb-3.4.3/data/mongodb.conf

    访问:mongo

    查看mongodb是否启动:

    netstat -nltp | grep 27017

    ps -ef|grep mongodb

    查看表信息:db.table.find().pretty()

    根据表字段查询:db.table.find({userId:4867})

    3、sqoop操作

    测试Sqoop是否能够成功连接数据库:bin/sqoop list-databases --connect jdbc:mysql://hadoop102:3306/ --username root --password 123456

    4、flume日志收集操作

    开启收集命令:bin/flume-ng agent -c conf -f conf/collect_click.conf -Dflume.root.logger=INFO,console -name a1

    三、网络通信工具netcat:

    安装:sudo yum install -y nc

    服务端:nc -lk 44444

    客户端: nc hadoop102 44444

  • 相关阅读:
    free online Twitter video downloader All In One
    Game Development Essential Terms All In One
    Offscreen Canvas All In One
    前端性能优化系列之 Service Workers 实战教程 All In One
    前端性能优化系列之 Web Workers 实战教程 All In One
    河南美食阿利茄汁面 All In One
    free online Youtube video downloader All In One
    Leetcode 2264. 字符串中最大的 3 位相同数字(可以,已解决)
    多分类任务中不同隐藏层层数对实验结果的影响(使用GPU)
    Pytorch 损失函数总结
  • 原文地址:https://www.cnblogs.com/wjh123/p/11537118.html
Copyright © 2020-2023  润新知