按步骤走就行:
Started: | Sat Apr 23 14:04:17 CST 2016 |
---|---|
Version: | 2.7.2, rb165c4fe8a74265c792ce23f546c64604acf0e41 |
Compiled: | 2016-01-26T00:08Z by jenkins from (detached from b165c4f) |
Cluster ID: | CID-b0ad8d51-6ea3-4bfc-a1d8-ee0cbc9a8ff6 |
Block Pool ID: | BP-890697487-127.0.1.1-1461391390144 |
--------------------------------spark安装
(2)配置Spark环境变量
export SPARK_HOME=/home/raini/spark
export PATH=${SPARK_HOME}/bin:$PATH
(3)配置spark-env.sh
export JAVA_HOME=/home/raini/app/jdk
export SCALA_HOME=/home/raini/app/scala
export SPARK_WORKER_MEMORY=4g
export SPARK_MASTER=biyuzhe
export SPARK_MASTER_PORT=7077
export SPARK_MASTER_WEBUI=8099
export SPARK_WORKER_CORES=2
export HADOOP_CONF_DIR=/home/raini/hadoop/etc/hadoop
(4)cp slaves.template slaves
#localhost
biyuzhe
spark/sbin/start-all.sh 启动
-------------------------------------------finish hive-site.xml
cp hive-log4j.properties.template hive-log4j.proprties
vi hive-log4j.properties
hive.log.dir=
这个是当hive运行时,相应的日志文档存储到什么地方
(mine:hive.log.dir=/usr/hive/log/${user.name})
hive.log.file=hive.log
这个是hive日志文件的名字是什么
默认的就可以,只要您能认出是日志就好,
只有一个比较重要的需要修改一下,否则会报错。
log4j.appender.EventCounter=org.apache.hadoop.log.metrics.EventCounter
如果没有修改的话会出现:
WARNING: org.apache.hadoop.metrics.EventCounter is deprecated.
please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
(只要按照警告提示修改即可)。
-------------------------------------------------------finish all
hive metastore 服务端启动命令:
hive --service metastore -p
raini@biyuzhe:~/app/hive/tmp$ hive --service metastore > /tmp/hive_metastore.log 2>&1 &
[1] 26856
这里Hive中metastore(元数据存储)采用Local方式,非remote方式。
报错:
Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)
第一次需执行初始化命令$raini@biyuzhe:~$ schematool -dbTypemysql –initSchema
raini@biyuzhe:~$ schematool -initSchema -dbType mysql -userName=hive -passWord=hive
查看初始化后信息$ schematool -dbType mysql –info
启动Hadoop服务:$sbin/start-dfs.sh和$sbin/start-yarn.sh
启动raini@biyuzhe:~/app$ hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/raini/app/hive2.0.0/lib/hive-jdbc-2.0.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/raini/app/hive2.0.0/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/raini/app/spark-1.6.1-bin-hadoop2.6/lib/spark-assembly-1.6.1-hadoop2.6.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/raini/app/hadoop-2.7.2/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Logging initialized using configuration in jar:file:/home/raini/app/hive2.0.0/lib/hive-common-2.0.0.jar!/hive-log4j2.properties
Sun Apr 24 11:25:41 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Apr 24 11:25:41 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Apr 24 11:25:41 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Apr 24 11:25:41 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Apr 24 11:25:43 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Apr 24 11:25:43 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Apr 24 11:25:43 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Apr 24 11:25:43 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. tez, spark) or using Hive 1.X releases.
hive (default)> show databases;
OK
default
Time taken: 1.017 seconds, Fetched: 1 row(s)
hive (default)>
hive (default)> create table test(id int, name string) row format delimited FIELDS TERMINATED BY ',';
报错FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)
开启metastore:
raini@biyuzhe:~/app$ hive --service metastore
Starting Hive Metastore Server
hive (default)> create table test(id int, name string) row format delimited FIELDS TERMINATED BY ',';
OK
Time taken: 1.613 seconds
可以看到mysql中的元数据信息:
raini@biyuzhe:~$ mysql -u hive -p
mysql> select* from TBLS
-> ;
+--------+-------------+-------+------------------+-------+-----------+-------+----------+---------------+--------------------+--------------------+
| TBL_ID | CREATE_TIME | DB_ID | LAST_ACCESS_TIME | OWNER | RETENTION | SD_ID | TBL_NAME | TBL_TYPE | VIEW_EXPANDED_TEXT | VIEW_ORIGINAL_TEXT |
+--------+-------------+-------+------------------+-------+-----------+-------+----------+---------------+--------------------+--------------------+
| 41 | 1461469991 | 1 | 0 | raini | 0 | 41 | test | MANAGED_TABLE | NULL | NULL |
+--------+-------------+-------+------------------+-------+-----------+-------+----------+---------------+--------------------+--------------------+
1 row in set (0.00 sec)
Hadoop中查看生成的文件:
raini@biyuzhe:~$ hdfs dfs -ls /user/hive/warehouse/
Found 1 items
drwxrwxrwx - raini supergroup 0 2016-04-24 11:53 /user/hive/warehouse/test