-
hive环境的搭建
-
必须要有hadoop
- 配置hive
- 重命名:mv bingsf bin
- 创建/user/hive/warehouse
- bin/hdfs dfs -mkdir /tmp
- bin/hdfs dfs -mkdir -p /user/hive/warehouse
- 为上边的两个目录添加用户组权限
- bin/hdfs dfs -chmod g+w /tmp
- bin/hdfs dfs -chmod g+w /user/hive/warehouse
- 修改配置文件
- $cp hive-en.sh.template hive-env.sh //文件不存在需要复制重命名。
-
HADOOP_HOME=/home/hadoop/opt/module/hadoop-2.7.3
#hive 配置文件所在的目录
export HIVE_CONF_DIR=/home/hadoop/opt/module/hive-1.1.0/conf
- 启动hive
- bin/hive
- mysql安装
- yum安装参考网址: https://www.cnblogs.com/weiyiyong/p/7636343.html
- 离线安装
-
2,卸载mysql
检测系统是否已经安装了mysql
sudo rpm -qa | grep -i mysql
如果安装了mysql,那么卸载掉
sudo rpm -e --nodeps mysql.......
3,离线安装mysql
-上传tar包到linux
-解压tar包
tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar -C mysql
-安装依赖的插件
sudo yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio libaio-devel
-如果冲突,卸载mariadb
sudo rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
-安装common
sudo rpm -ivh mysql-community-common-5.7.27-1.el7.x86_64.rpm
-安装libs
sudo rpm -ivh mysql-community-libs-5.7.27-1.el7.x86_64.rpm
-安装client
sudo rpm -ivh mysql-community-client-5.7.27-1.el7.x86_64.rpm
-安装perl插件
sudo yum install -y perl
-安装server
sudo rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm
启动服务
systemctl status mysqld 查看状态
systemctl start mysqld 启动mysql服务
systemctl enable mysqld 启动开机启动项
获取mysql的临时密码
sudo grep 'temporary password' /var/log/mysqld.log
用临时密码登录mysql mysql -u root –p
修改密码
set password for root@localhost=password('Abc1234!');修改root远程访问权限 密码等级设置最低 set global validate_password_policy=0 -
grant all privileges on *.* to root@'%' identified by 'Abc1234!';
刷新权限生效
flush privileges;
9、重启mysqld服务
$ sudo systemctl restart mysqld.service - 配置远程metastore 服务
- 参考官网文档: https://cwiki.apache.org/confluence/display/Hive/AdminManual+Metastore+Administration
- 修改conf/hive-site.xml 该文件来源c:hive-default.xml.template hive-site.xml
-
<configuration>
<propery>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql:hadoop100/metastore?createDatabaseIfNotExist=true</value>
</property>
<propery>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<propery>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<propery>
<name>javax.jdo.option.ConnectionPassword</name>
<value>111111</value>
</property><!--设置远程服务-->
<propery>
<name>hive.metastore.uris</name>
<value>thrift://hadoop100:9083</value>
</property> -
</configuration>
- 将mysql jar包放到他hive/lib下边
- 在启动远程服务的时候我们需要手动启动metastore服务 bin/hive --service metastore &
- 配置日志路径:zai log4jproperty
-
hive.log.threshold=ALL
hive.root.logger=INFO,DRFA
hive.log.dir=/home/hadoop/opt/module/hive-1.2.1/logs
hive.log.file=hive.log - 配置默认数据库的名称:在hive-site.xml中加
-
<!--显示当前数据库名-->
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<!--显示表的列名-->
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
-