首先系統爲Centos7,yum源使用的aliyun的.java
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
yum -y install mysql-community-server
加入開機啓動mysql
systemctl enable mysqld
啓動mysql服務進程sql
systemctl start mysqld
重置密碼數據庫
[root@master ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] y [設置root用戶密碼] New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y [刪除匿名用戶] ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n [禁止root遠程登陸] ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y [刪除test數據庫] - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y [刷新權限] ... Success! All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Cleaning up...
//登陸MYSQL(ROOT權限) [root@master ~]# mysql -u root -p //首先爲用戶建立一個數據庫hivemeta mysql > create database hivemeta; mysql > use hivemeta //受權hdp用戶擁有hivemeta數據庫的全部權限。 mysql > grant all privileges on *.* to hdp@"%" identified by "hdp" with grant option; //刷新系統權限表 mysql > flush privileges; mysql > use hivemeta; //mysql/hive字符集問題 mysql > alter database hivemeta character set latin1;
wget http://mirrors.hust.edu.cn/apache/hive/hive-1.2.2/apache-hive-1.2.2-bin.tar.gz tar -zxvf apache-hive-1.2.2-bin.tar.gz mv apache-hive-1.2.2 hive
vi /etc/profile --添加以下內容 export HIVE_HOME=.....(本身安裝路徑)/hive export HIVE_CONF_DIR=$HIVE_HOME/conf export CLASSPATH=$CLASSPATH:$HIVE_HOME/lib export PATH=$PATH:$HIVE_HOME/bin --配置生效 source /etc/profile
進入hive-1.2.2/conf目錄,複製hive-env.sh.templaete爲hive-env.sh: cd /.../hive-1.2.2/conf cp hive-env.sh.template hive-env.sh vi hive-env.sh export HADOOP_HOME=/.../hadoop-2.8.1
<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://master:3306/hivemeta?useUnicode=true&characterEncoding=UTF-8&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>root</value> </property> <property> <name>hive.exec.local.scratchdir</name> <value>/usr/local/hive/iotmp</value> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/usr/local/hive/iotmp</value> <description>Temporary local directory for added resources in the remote file system. </description> </property> <property> <name>hive.querylog.location</name> <value>/usr/local/hive/iotmp</value> <description>Location of Hive run time structured log file </description> </property> <property> <name>hive.exec.local.scratchdir</name> <value>/usr/local/hive/iotmp</value> <description>Local scratch space for Hive jobs</description> </property> </configuration>
cp hive-log4j.properties.template hive-log4j.properties
vi hive-log4j.properties
hive.log.dir=/...../hive/log ## 將hive.log日誌的位置改成${HIVE_HOME}/log目錄下
mkdir ${HIVE_HOME}/log
放入到hive安裝目錄的lib文件夾下 cp /.../mysql-connector-java-5.1.6-bin.jar /.../hive/lib/
將$HIVE_HOME/lib
目錄下的jline-2.12.jar
包拷貝到$HADOOP_HOME/share/hadoop/yarn/lib
目錄下,並刪除$HADOOP_HOME/share/hadoop/yarn/lib
目錄下舊版本的jline
包apache
cp jline-2.12.jar /.../hadoop-2.8.1/share/hadoop/yarn/lib/
複製$JAVA_HOME/lib
目錄下的tools.jar
到$HIVE_HOME/lib
下ide
cp $JAVA_HOME/lib/tools.jar ${HIVE_HOME}/lib
9:建立mysql中的schemaoop
schematool -dbType mysql -initSchema