标签:查询 /etc/ ble nbsp span string 基本 回车 直接
首先安装mysql
a) yum install mysql
b) yum install mysql-devel
c) 安装mariadb yum install mariadb-server mariadb
d) systemctl enable mariadb #设置开机启动
e) systemctl start mariadb #开启服务
f) mysql -u root -p 首次登陆不需要密码,直接回车即可进入
g) 修改mysql密码 set password = password(‘root‘);
h) 开启mysql的远程登录 grant all privileges on *.* to ‘root‘ @‘%‘ identified by ‘root‘;
i) 刷新 flush privileges;
a) 在/opt/software/hive 下解压hive tar -xvf *** (安装包可以私聊我要,不知道怎么上传安装包)
b) 修改 /etc/profile 文件 vi /etc/profile
# Hive environment
export HIVE_HOME=/opt/software/hive/apache-hive-2.1.1-bin
export PATH=$HIVE_HOME/bin:$HIVE_HOME/conf:$PATH
c) 使环境变量生效 source /etc/profile
d) 在hive/conf目录下创建hive-site.xml文件 mkdir hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>root</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>123456</value> </property> <property> <name>hive.metastore.schema.verification</name> <value>true</value> <description> Enforce metastore schema version consistency. True: Verify that version information stored in metastore matches with one from Hive jars. Also disable automatic schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures proper metastore schema migration. (Default) False: Warn if the version information stored in metastore doesn‘t match with one from in Hive jars. </description> <property> <name>hive.metastore.uris</name> <value>thrift://localhost:9083</value> </property> </property> </configuration>
e) 在$HIVE_HOME/lib中导入mysql的jar包,jar包在结尾
f) 数据库的初始化 bin/schematool -initSchema -dbType mysql
(加local是本地,overwrite into会覆盖)
create table wyp (id int, name string,age int, tel string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t‘ STORED AS TEXTFILE;
load data local inpath ‘wyp.txt‘ into table wyp;
load data inpath ‘/home/wyp/add.txt‘ into table wyp;
create table test(id int, name string,tel string) partitioned by (age int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t‘ STORED AS TEXTFILE;
insert into table test partition (age=‘25‘) select id, name, tel from wyp;
create table test4 as select id, name, tel from wyp;
insert overwrite local directory ‘/home/wyp/wyp‘
生成的文件名是000000_0.
insert overwrite directory ‘/home/wyp/hdfs‘
insert into table test partition (age=‘25‘) select id, name, tel from wyp;
标签:查询 /etc/ ble nbsp span string 基本 回车 直接
原文地址:http://www.cnblogs.com/cui0614/p/7769059.html