elasticsearch使用那点事

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch使用那点事相关的知识,希望对你有一定的参考价值。

LZO表创建:


create table lzoer(id int,name string, ip string)ROW FORMAT DELIMITED

FIELDS TERMINATED BY ‘,‘ STORED AS INPUTFORMAT ‘com.hadoop.mapred.DeprecatedLzoTextInputFormat‘ OUTPUTFORMAT ‘org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat‘;


LZO表创建索引:

hadoop jar /usr/hdp/2.2.6.0-2800/hadoop/lib/hadoop-lzo-0.6.0.2.2.6.0-2800.jar  com.hadoop.compression.lzo.DistributedLzoIndexer  hdfs://hadoop001:8020/apps/hive/warehouse/hly.db/lzo_aa/1.txt.lzo


TXT表创建:


CREATE TABLE wubai(id int,name string,ip string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,‘ STORED AS TEXTFILE;


ES表创建:


CREATE EXTERNAL TABLE eswubai(

id bigint,

name string,

ip string)

STORED BY ‘org.elasticsearch.hadoop.hive.EsStorageHandler‘

TBLPROPERTIES(‘es.resource‘ = ‘wubai/wubai‘,‘es.nodes‘=‘ip‘,‘es.port‘=‘9200‘,‘es.nodes.wan.only‘=‘true‘,‘es.mapping.names‘=‘id:esid,name:esname,ip:esage‘);


LOAD数据:


load data local inpath ‘/usr/local/999.txt‘ into table estest.test01_source;

LOAD DATA LOCAL INPATH ‘/usr/local/500.txt.lzo‘ OVERWRITE INTO TABLE lzowubai; 


INSERT INTO 数据:


insert overwrite table eswuk select * from wuk;

insert into eser select * from wu;

insert overwrite table web select s.id, s.name, s.ip, s.time from test01_source s;

以上是关于elasticsearch使用那点事的主要内容,如果未能解决你的问题,请参考以下文章

Python那点事

重载delete时的那点事

微服务那点事

iOS_UITableView性能优化那点事

python模块那点事

有关 onSaveInstanceState() 那点事