常用命令

du --max-depth=1 -h
balancer_enabled
balance_switch false
ps auxw|head -1;ps auxw|sort -rn -k4|head -10
echo 1 > /proc/sys/vm/drop_caches
yarn node -list -all
yarn  application -list -appStates RUNNING
yarn  application -list -appTypes MAPREDUCE
yarn  application -kill application_1526100291229_206393
yarn  application -status application_1526100291229_206393
yarn  application -movetoqueue application_1526100291229_206393 -queue other
yarn add  依赖会记录在 package.json 的 dependencies 下
yarn global add  全局安装依赖
yarn list
yarn cache list/dir/clean
yarn applicationattempt  -list /-status
yarn logs -applicationId application_1437364567082_0104  -appOwner hadoop
yarn container -list  /-status 
yarn queue 	-status 

常用命令:
redhat7.2设置主机名

hostnamectl set-hostname [email protected]

impala 跟新元数据

invalidate metadata

向分区中添加数据

insert into table odm.hds_custom partition (year_month='201801') select * from hdm.hds_custom;

增加字段

alter table hds_custom add columns (start_dt STRING)
alter table hds_custom add columns (end_dt STRING)

增加分区

alter table hds_custom add partition(year_month) location '';

hbase中以startRow和endRow查看信息

scan 'custom_info',{ STARTROW => '', STOPROW =>''}

列过滤

scan 'custom_info',{ STARTROW => '', STOPROW =>'',FILTER => "ColumnPrefixFilter('trans_no')"}

值过滤

scan 'custom_info',{ STARTROW => '', STOPROW =>'',FILTER => "ValueFilter(=,'binary:A')"}

模糊查询

scan 'custom_info',{ STARTROW => '', STOPROW =>'',FILTER => "ValueFilter(=,'substring:A')"}

前缀过滤器

scan 'custom_info',{ STARTROW => '', STOPROW =>'',FILTER => "PrefixFilter(=,'first')"}

赋权操作
hbase 赋权操作

Grant 'user','RWXCA','tab'
Grant 'user','RWXCA'
Grant 'user','R'
Grant 'user','RWXCA','tab','f1','age'

sentry 赋权操作

create role hive;
GRANT ALL ON SERVER server1 TO ROLE hive;
GRANT ROLE hive TO GROUP hive;

GRANT ALL ON DATABASE default to role wzz;
GRANT ROLE WZZ TO GROUP WZZ;
GRANT SELECT(column_name) ON TABLE table_name TO ROLE role_name;

添加用户到组
useradd -g hive etluser 将etluser添加到hive组

kerberos 认证方式

kinit -kt hive.keytab hive
hive: beeline -u "jdbc:hive2://10.7.67.120:10000/default;principal=hive/[email protected]"
hive: beeline -u "jdbc:hive2://10.7.67.120:21050/default;principal=hive/[email protected]" -e "invalidate metadata"

LDAP:

beeline -u jdbc:hive2://10.7.67.120:10000 -n hive -p hive
impala-shell -i 10.7.67.120 -u hive --auth_creds_ok_in_clear

impala 分页

select custom_no,start_dt,end_dt from hds_trans order by custm_no limit 3 offset 3;

select count(*) as ant,start_dt,end_dt from hds_custom where custom_no = "1231231231" group by start_dt,end_dt;

set hvie.aux.jars.path=/opt/cloudera/parcels/CDH-5.13/lib/hive-contrb.jar;
set security.authrization.enabled=false;
set hive.server2.authorization.external.exec=true;

hive 分页

select *,row_number() over(partition by year_month order by trans_no) rank from hdm.hds_custom limit 5;
select * from (select custom_no,trans_no,start_dt,end_dt,year_month,row_number() over (partition by year_month order by trans_no)) rank from hdm.hds_custom)t where rank >=1 and rank <=10;

//KMS

hadoop fs -cat /.reserved/raw/secret/123.txt

Haproxy -f /etc/haproxy/hy_hive.cfg -sf `cat /var/run/haproxy.pid`

python 链接ldap的

from impala.dbapi import connect
conn=connect(host="10.7.67.120",port=10000,database='default',auth_mechanism='PLAIN',user='hive',password='hive')
cur=conn.cursor()
cur.excute("show databases")
sur.fetchall()
--ldap_password_in_clear_ok 
-authorized_proxy_user_config=hive=*
ldapdelete -x -D "cn=Manager,dc=hds,dc=com" -w 123123 "uid=etluser,ou=people,dc=hds,dc=com"

关闭下线一台regionserver

bin/graceful_stop.sh --stop  regionserver_nodename;

重启一个regionserver

bin/graceful_stop.sh --restart --reload --debugregionserver_nodename;
nohup /usr/local/hadoop/filebeat-release/filebeat -c /usr/local/hadoop/filebeat-release/filebeat.yml &
ansible -i  batch/hosts nodemanager -m raw -a "ps -ef | grep filebeat"
export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10101"
export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10102"
export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10103"
export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10104"
export HBASE_REST_OPTS="$HBASE_REST_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10105"
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT   
393216.0 393216.0 13437.8  0.0   2359296.0 119800.2 13631488.0  323529.7  262144.0 51647.7     14    1.337   0      0.000    1.337
393216.0 393216.0 13437.8  0.0   2359296.0 136793.5 13631488.0  323529.7  262144.0 51647.7     14    1.337   0      0.000    1.337

S0C:年轻代中第一个survivor(幸存区)的容量 (字节)
S1C:年轻代中第二个survivor(幸存区)的容量 (字节)
S0U:年轻代中第一个survivor(幸存区)目前已使用空间 (字节)
S1U:年轻代中第二个survivor(幸存区)目前已使用空间 (字节)
EC:年轻代中Eden(伊甸园)的容量 (字节)
EU:年轻代中Eden(伊甸园)目前已使用空间 (字节)
OC:Old代的容量 (字节)
OU:Old代目前已使用空间 (字节)
YGC:从应用程序启动到采样时年轻代中gc次数
YGCT:从应用程序启动到采样时年轻代中gc所用时间(s)
FGC:从应用程序启动到采样时old代(全gc)gc次数
FGCT:从应用程序启动到采样时old代(全gc)gc所用时间(s)
GCT:从应用程序启动到采样时gc用的总时间(s)

1.DEFAULT_DOMAIN_POINT_TOPIC_V2这topic的retention.ms改成3600000 rule-engine- 1天
2.rule-engine.dispatch.toDefaultDomainTopic false
3.告警
each(metric=kafka-lag-metric topic=eos-mqtt.kafka.data_prod env=kafka-cn-prod group=mqtt2oldstream)
each(metric=kafka-lag-metric topic=rule_engine_internal_redis_topic env=huaneng2-kafka group=mqtt2oldstream)
each(metric=kafka-lag-metric topic=rule_engine_internal_topic env=huaneng2-kafka group=mqtt2oldstream)

metric=concurrentmarksweep.gc.avg.time jmxport=10102
metric=concurrentmarksweep.gc.count jmxport=10102
metric=gc.throughput jmxport=10102
metric=new.gen.avg.promotion jmxport=10102
metric=new.gen.promotion jmxport=10102
metric=old.gen.mem.ratio jmxport=10102
metric=old.gen.mem.used jmxport=10102
metric=parnew.gc.avg.time jmxport=10102
metric=parnew.gc.count jmxport=10102
metric=thread.active.count jmxport=10102
metric=thread.peak.count jmxport=10102
nohup hdfs balancer -policy datanode -threshold 5 > balancer.log &

这里曾经发生过一个bug,使用Kafka0.8.1的时候,kafka controller在Zookeeper上注册成功后,
它和Zookeeper通信的timeout时间是6s,也就是如果kafka controller如果有6s中没有和Zookeeper做心跳,
那么Zookeeper就认为这个kafka controller已经死了,就会在Zookeeper上把这个临时节点删掉,
那么其他Kafka就会认为controller已经没了,就会再次抢着注册临时节点,注册成功的那个kafka broker成为controller,
然后,之前的那个kafka controller就需要各种shut down去关闭各种节点和事件的监听。但是当kafka的读写流量都非常巨大的时候,

一个bug是,由于网络等原因,kafka controller和Zookeeper有6s中没有通信,于是重新选举出了一个新的kafka controller,
但是原来的controller在shut down的时候总是不成功,这个时候producer进来的message由于Kafka集群中存在两个kafka controller而无法落地。导致数据淤积。

这里曾经还有一个bug
当ack=0的时候,表示producer发送出去message,
只要对应的kafka broker topic partition leader接收到的这条message,producer就返回成功,不管partition leader 是否真的成功把message真正存到kafka。
当ack=1的时候,表示producer发送出去message,同步的把message存到对应topic的partition的leader上,然后producer就返回成功,partition leader异步的把message同步到其他partition replica上。
当ack=all或-1,表示producer发送出去message,同步的把message存到对应topic的partition的leader和对应的replica上之后,才返回成功。但是如果某个kafka controller 切换的时候,
会导致partition leader的切换(老的 kafka controller上面的partition leader会选举到其他的kafka broker上),但是这样就会导致丢数据。

你可能感兴趣的:(个人问题检索)