溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

elasticsearch使用那點(diǎn)事

發(fā)布時(shí)間:2020-06-13 13:35:04 來(lái)源:網(wǎng)絡(luò) 閱讀:723 作者:王上京小伙 欄目:大數(shù)據(jù)

LZO表創(chuàng)建:


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表創(chuàng)建索引:

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表創(chuàng)建:


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


ES表創(chuàng)建:


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數(shù)據(jù):


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 數(shù)據(jù):


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問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI