七、GP設置-hadoop環境の構築
3193 ワード
一、hadoopクライアントのインストール
tar -xvzf hadoop-2.6.0-cdh5.7.6.tar.gz
cd /opt/greenplum
ln -s hadoop-2.6.0-cdh5.7.6 hadoop
export HADOOP_HOME=/opt/greenplum/hadoop
export PATH=$HADOOP_HOME/bin:$PATH
source ~/.bash_profile
hdfs dfs -ls /
二、hadoopクライアントをクラスタの他のサーバーに配置する
tar -cvzf hadoop.tar.gz hadoop-2.6.0-cdh5.7.6
gpscp -f /opt/greenplum/other_hosts hadoop.tar.gz =:/opt/greenplum/
gpssh -f /opt/greenplum/other_hosts
=> cd /opt/greenplum
[kylin-203-122]
[kylin-203-117]
[kylin-203-130]
=> tar -xvzf hadoop.tar.gz
...
=> ln -s hadoop-2.6.0-cdh5.7.6 hadoop
[kylin-203-122]
[kylin-203-117]
[kylin-203-130]
=> exit
gpscp -f /opt/greenplum/other_hosts ~/.bash_profile =:~/.bash_profile
三、gp構成の修正 gpconfig -c gp_hadoop_target_version -v "cdh"
gpconfig -c gp_hadoop_home -v "/opt/greenplum/hadoop"
#
gpstop -u
#
gpconfig --show gp_hadoop_target_version
gpconfig --show gp_hadoop_home
四、gpにデータをインポートする
gpconfig -c gp_hadoop_target_version -v "cdh"
gpconfig -c gp_hadoop_home -v "/opt/greenplum/hadoop"
#
gpstop -u
#
gpconfig --show gp_hadoop_target_version
gpconfig --show gp_hadoop_home
create table public.kylin_sales_dyprt (
trans_id bigint,
part_dt date,
lstg_format_name character varying,
leaf_categ_id bigint,
lstg_site_id int,
slr_segment_cd smallint,
price decimal (19, 4),
item_count bigint,
seller_id bigint,
buyer_country character varying,
seller_country character varying,
user_id character varying,
region character varying
) WITH (
appendonly = true,
orientation = column,
compresstype = zlib,
COMPRESSLEVEL = 5
) distributed randomly partition by range (part_dt) (
partition p_20120101 start ('2012-01-01' ::date) inclusive
end ('2012-01-02' ::date)
) ;
CREATE EXTERNAL TABLE public.hdfs_kylin_sales_dyprt (
trans_id BIGINT,
part_dt DATE,
lstg_format_name CHARACTER VARYING,
leaf_categ_id BIGINT,
lstg_site_id INT,
slr_segment_cd SMALLINT,
price DECIMAL (19, 4),
item_count BIGINT,
seller_id BIGINT,
buyer_country CHARACTER VARYING,
seller_country CHARACTER VARYING,
user_id CHARACTER VARYING,
region CHARACTER VARYING
) LOCATION (
'gphdfs://bigdatacluster:8888/user/hive/warehouse/test.db/kylin_sales_dyprt/year=2012/month=1/day=1'
) FORMAT'text' (
DELIMITER ','
NULL '\N' ESCAPE 'off'
) ENCODING 'UTF8' ;
insert into kylin_sales_dyprt select * from hdfs_kylin_sales_dyprt ;