温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

elasticsearch使用那点事

发布时间:2020-06-13 13:35:04 来源:网络 阅读:708 作者:王上京小伙 栏目:大数据

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;

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI