Dockerfiles/hive/2.1.1/README.md

73 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2017-09-02 06:44:57 +00:00
Run Aapache Hive with Docker
2018-08-06 12:35:09 +00:00
## Prequirements
2017-09-02 06:44:57 +00:00
2018-08-06 12:35:09 +00:00
Assume you already have one Hadoop cluster whose master node host is `hadoop-master`;
2017-09-02 06:44:57 +00:00
2018-08-06 12:35:09 +00:00
Assume you already have a Mysql server whose host is `mysql`;
2017-09-02 06:44:57 +00:00
2018-08-06 12:35:09 +00:00
You can specify them in `conf/hive-site.xml`;
2017-09-02 06:44:57 +00:00
2018-08-06 12:35:09 +00:00
## Start Hive Node
2017-09-02 06:44:57 +00:00
```
docker service create \
2018-08-06 12:35:09 +00:00
--name hive \
--hostname hive \
--network swarm-net \
--replicas 1 \
--detach=true \
--mount type=bind,source=/etc/localtime,target=/etc/localtime \
newnius/hive:2.1.1
2017-09-02 06:44:57 +00:00
```
## Init && Test
2018-08-06 12:35:09 +00:00
Init HIVE for the first time
2017-09-02 06:44:57 +00:00
2018-08-06 12:35:09 +00:00
#### Create HIVE dir in HDFS
2017-09-02 06:44:57 +00:00
```bash
2018-08-06 12:35:09 +00:00
$HADOOP_HOME/bin/hdfs dfs -mkdir /tmp
$HADOOP_HOME/bin/hdfs dfs -mkdir -p /user/hive/warehouse
$HADOOP_HOME/bin/hdfs dfs -chmod g+w /tmp
$HADOOP_HOME/bin/hdfs dfs -chmod g+w /user/hive/warehouse
2017-09-02 06:44:57 +00:00
```
2018-08-06 12:35:09 +00:00
#### Init MetaStore
2017-09-02 06:44:57 +00:00
```bash
2018-08-06 12:35:09 +00:00
schematool --dbType mysql --initSchema
```
2018-08-06 13:08:28 +00:00
#### Start MetaStore service
```bash
nohup hive --service metastore &
```
2018-08-06 12:35:09 +00:00
#### Validate Installation
Run `hive` to start the hive shell
If the following command is executed successfully, then the installation is fine.
```hive
CREATE TABLE pokes (foo INT, bar STRING);
2017-09-02 06:44:57 +00:00
```
2018-08-06 13:08:28 +00:00
## Custom configuration
To persist data or modify the conf files, refer to the following script.
The `/config/hive` path is where new conf files to be replaces, you don't have to put all the files.
```bash
docker service create \
--name hive \
--hostname hive \
--network swarm-net \
--replicas 1 \
--detach=true \
--mount type=bind,source=/etc/localtime,target=/etc/localtime \
--mount type=bind,source=/data/hive/config,target=/config/hive \
newnius/hive:2.1.1
```