LoginSignup
1
1

More than 5 years have passed since last update.

Docker上のCentOS7にsqoopをインストールしたい

Last updated at Posted at 2019-02-11

要約

  • hadoopは特に使わないがとにかくsqoopだけ使いたい需要があり、CentOS7にインストールしたので手順の記録を残す。
  • 結論としてはCDH5でインストールしたら出来た。
  • 正しい手順なのか全く確証は無い。

環境

  • ubuntu 18.04上にCentOS7のdocker imageを入れて環境を構築する。
  • インストールにはCDH5を使う。

手順

CentOS7にsqoopがインストールされたDockerfileを作成していく。

OSの指定とか

とりあえずbase imageの指定, workdirの指定, wgetのインストールを行う。

FROM centos:centos7

WORKDIR /work
RUN yum install -y wget

CDH5の設定

RUN wget https://archive.cloudera.com/cdh5/redhat/7/x86_64/cdh/cloudera-cdh5.repo
RUN mv cloudera-cdh5.repo /etc/yum.repos.d/

RUN yum clean all

CDH5のインストール手順を読むと、引き続きこれらの作業を行うように書かれているが、やらなくてもsqoopは動いたのでコメントアウトしておく。

# RUN rpm --import https://archive.cloudera.com/cdh5/redhat/7/x86_64/cdh/RPM-GPG-KEY-cloudera

# RUN yum install -y hadoop-yarn-resourcemanager
# RUN yum install -y hadoop-0.20-mapreduce-jobtracker
# RUN yum install -y hadoop-lzo

sqoopのインストール

まずOracle-jdkをインストールしてくるように指定されているがインストールが面倒だったのでとりあえずopen-jdkをインストールしてみる。

# install jdk
RUN yum install -y java-1.7.0-openjdk java-1.7.0-openjdk-devel

そしてsqoopのインストール

RUN yum install -y sqoop

動かしてみる

docker-compose.yamlを書いてdocker imageを起動。

docker-compose.yaml
version: '2.3'
services:
  sqoop-test:
    build: .

sqoopを動かしてみる。

$ sudo docker-compose run sqoop-test /bin/bash
[root@e69d1a841985 work]# sqoop help
Warning: /usr/lib/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/lib/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
19/02/11 05:43:03 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.16.1
usage: sqoop COMMAND [ARGS]

Available commands:
  codegen            Generate code to interact with database records
  create-hive-table  Import a table definition into Hive
  eval               Evaluate a SQL statement and display the results
  export             Export an HDFS directory to a database table
  help               List available commands
  import             Import a table from a database to HDFS
  import-all-tables  Import tables from a database to HDFS
  import-mainframe   Import datasets from a mainframe server to HDFS
  job                Work with saved jobs
  list-databases     List available databases on a server
  list-tables        List available tables in a database
  merge              Merge results of incremental imports
  metastore          Run a standalone Sqoop metastore
  version            Display version information

See 'sqoop help COMMAND' for information on a specific command.

とりあえず動いた.(完)

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1