大型数据库(4)--- Sqoop安装与配置

8 篇文章 0 订阅
8 篇文章 0 订阅

安装说明

安装环境

虚拟机:VirtualBox-6.1.18
操作系统:Ubuntu16.04LTS
Hadoop:2.7.3
MySQL:5.7.33-0ubuntu0.16.04.1 (Ubuntu)

本次安装的Sqoop

Sqoop版本:1.99.7
官方文档:sqoop-docs/1.99.7
下载地址:sqoop-1.99.7-bin-hadoop200.tar.gz
其他:Sqoop官网查看不同版本.

都准备就绪后,我们就接着往下开始安装吧!
不知道怎么准备的,我之前的文章 也许可以给你带来一些参考哦 - - - ☞ 传送门
大型数据库(1)— Hive安装与配置.


开始安装

  1. 我的两个基础软件Hadoop、Java 分别是在/usr/hadoop 和 /usr/java下
  2. 其他的都安装在 ~/Hadoop 的文件夹下
  3. Sqoop仅需安装在hadoop-master下哦

配置MySQL

当前是root用户登录mysql

mysql> drop database if exists sqoop;

mysql> create database sqoop;

mysql> SET GLOBAL sql_mode = ANSI_QUOTES;

再将连接器(mysql-connector-java-5.1.27-bin.jar)CV到 $SQOOP_HOME/server/lib


安装并配置Sqoop

1. 解压

$ cd ~/下载
$ cp sqoop-1.99.7-bin-hadoop200.tar.gz ~/Hadoop
$ cd ~/Hadoop
$ tar -zxvf sqoop-1.99.7-bin-hadoop200.tar.gz
$ mv sqoop-1.99.7-bin-hadoop200 sqoop-1.99.7
$ cd sqoop-1.99.7/conf/


2. 配置

2.1 sqoop.properties
// 将此处的JDBC改为mysql的
# JDBC repository provider configuration
org.apache.sqoop.repository.jdbc.handler=org.apache.sqoop.repository.mysql.MySqlRepositoryHandler
org.apache.sqoop.repository.jdbc.transaction.isolation=READ_COMMITTED
org.apache.sqoop.repository.jdbc.maximum.connections=10
org.apache.sqoop.repository.jdbc.url=jdbc:mysql://localhost:3306/sqoop
org.apache.sqoop.repository.jdbc.driver=com.mysql.jdbc.Driver
org.apache.sqoop.repository.jdbc.user=hadoop
org.apache.sqoop.repository.jdbc.password=hadoop

// 将此处的路径改为 自己的Hadoop的配置文件的路径
# Hadoop configuration directory
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/usr/hadoop/etc/hadoop

// 去掉安全部分的注释
# Authentication configuration
org.apache.sqoop.security.authentication.type=SIMPLE
org.apache.sqoop.security.authentication.handler=org.apache.sqoop.security.authentication.SimpleAuthenticationHandler
org.apache.sqoop.security.authentication.anonymous=true

2.2 core-site.xml

因为是sqoop2,所以我们还需要配置$HADOOP_HOME/etc/hadoop下的 core-site.xml 文件

// 在该文件中增加以下两个属性
<property>
	<name>hadoop.proxyuser.sqoop2.hosts</name>
	<value>*</value>
</property>
<property>
	<name>hadoop.proxyuser.sqoop2.groups</name>
	<value>*</value>
</property>

2.3 container-executor.cfg

添加能运行sqoop2服务器的用户
编辑$HADOOP_HOME/etc/hadoop下的 container-executor.cfg 文件

allowed.system.users=xld	// 这里'xld'改为自己登陆 Ubuntu 时的用户名
2.4 环境变量
// 这里直接是 /etc/profile ,当然你也可以加到 .bash_profile 下也行
$ sudo gedit .bash_profile

// 然后添加以下内容:
export SQOOP_HOME=/home/xld/Hadoop/sqoop-1.99.7
export PATH=$SQOOP_HOME/bin:$PATH
export CATALINA_HOME=$SQOOP_HOME/server
export SQOOP_SERVER_EXTRA_LIB=$SQOOP_HOME/server/lib
export LOGDIR=$SQOOP_HOME/logs

// 保存并退出,然后使其生效
$ source .bash_profile


3. 启动Sqoop

// 启用工具进行验证
$ cd ~/Hadoop/sqoop-1.99.7/bin
$ ./sqoop2-tool verify

验证成功,可以看到下面有successful验证成功

// 验证成功后,可以开启服务器了
$ ./sqoop2-server start

启动成功,可以看到 Sqoop2 server started.

输入 $ jps 可以看到 SqoopJettyServer

启动成功



其他

参考文章:

1. sqoop1.99.7安装、使用及部分问题

2. sqoop2 初始化时 sql语法错误



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sure! Here's a step-by-step guide to deploying Sqoop on Ubuntu: 1. Install Java Development Kit (JDK): - Open Terminal and run the command: `sudo apt update` - Install OpenJDK by running: `sudo apt install openjdk-8-jdk` 2. Verify Java installation: - Run the command: `java -version` - You should see java version information printed on the console. 3. Download and install Sqoop: - Visit the Apache Sqoop website (https://sqoop.apache.org/) and navigate to the "Downloads" section. - Choose the latest stable release and copy the download link for the binary package (e.g., sqoop-x.x.x.bin__hadoop-x.x.x.tar.gz). - In Terminal, navigate to the directory where you want to install Sqoop. - Download the package using the command: `wget [download_link]` (replace [download_link] with the actual download link). - Extract the downloaded package using: `tar -xvf sqoop-x.x.x.bin__hadoop-x.x.x.tar.gz` (replace x.x.x with the version number). 4. Configure Sqoop: - Open the Sqoop configuration file using a text editor: `sudo nano sqoop-x.x.x.bin__hadoop-x.x.x/conf/sqoop-env.sh` - Set the JAVA_HOME variable to your JDK installation path. For example: `export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64` - Save and close the file. 5. Set up environment variables: - Open the ~/.bashrc file in a text editor: `nano ~/.bashrc` - Add the following lines at the end of the file: ``` export SQOOP_HOME=/path/to/sqoop export PATH=$PATH:$SQOOP_HOME/bin ``` - Save and close the file. - Run `source ~/.bashrc` to apply the changes. 6. Test Sqoop installation: - Run the command: `sqoop version` - You should see the Sqoop version information printed on the console without any errors. Congratulations! You have successfully deployed Sqoop on Ubuntu. You can now use Sqoop for data transfer between Hadoop and relational databases.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值