标签:ada 索引 sep ... delete root init -- cto
#删除HBase表
echo "Clean HBase tables..." > /dev/null 2>&1
echo "disable ‘HIK_SMART_METADATA_COM‘" | bin/hbase shell -n > /dev/null 2>&1
echo "drop ‘HIK_SMART_METADATA_COM‘" | bin/hbase shell -n > /dev/null 2>&1
#创建HBase表
echo "create ‘HIK_SMART_METADATA‘, {NAME => ‘info‘, VERSIONS => ‘3‘, COMPRESSION => ‘SNAPPY‘}, {NAME => ‘model‘, VERSIONS => ‘3‘, COMPRESSION => ‘SNAPPY‘}, {NAME => ‘trace‘, VERSIONS => ‘3‘, COMPRESSION => ‘SNAPPY‘}, SPLITS_FILE => ‘$splits_file‘" | $HBASE_HOME/bin/hbase shell -n > /dev/null 2>&1
splits_file=/tmp/hbase-table-splits.txt(Region划分文件)
#删除ES索引
$SPARK_HOME/bin/beeline -u $UDE_URL -n root -p 123456 -e "drop index HIK_SMART_METADATA on HIK_SMART_METADATA"
UDE_URL=jdbc:zk://hdh1,hdh2,hdh3(UDE ZK地址)
#创建ES索引
$SPARK_HOME/bin/beeline -u $UDE_URL -n root -p 123456 -e "create index HIK_SMART_METADATA on HIK_SMART_METADATA OPTIONS ( clusterName ‘$ES_CLUSTER_NAME‘, separationIndexType ‘TimeSegment‘, shardNumOfIndex ‘2‘, copyNumOfIndex ‘0‘, separationIndexField ‘timestamp_‘, separationStartTime ‘$SMART_METADATA_SEPARATION_START_TIME‘, separationEndTime ‘$SMART_METADATA_SEPARATION_END_TIME‘, separationTimeInterval ‘day:7‘)"
ES_CLUSTER_NAME=SERVICE-ELASTICSEARCH-0bdd3e8929f24774bb1837690c323f58(ES集群名称)
SMART_METADATA_SEPARATION_START_TIME=2016-01-01 00:00:00(YML里面router.rules.initialdate参数配置)
SMART_METADATA_SEPARATION_END_TIME=2016-12-01 00:00:00(当前时间一个月之后的时间)
#删除KAFKA主题
/usr/lib/hdh/kafka/bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic topic
创建Kafka主题
$KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper $KAFKA_ZK --topic HIK_SMART_METADATA_TOPIC --config retention.ms=259200000 --partitions 10 --replication-factor $replication_num
KAFKA_ZK=hdh1:2181,hdh2:2181,hdh3:2181
replication_num=1(Kafka消息副本数,单机只能为1)
标签:ada 索引 sep ... delete root init -- cto
原文地址:http://www.cnblogs.com/jinniezheng/p/6375741.html