当前位置: 首页 > news >正文

腾讯云网站建设视频教程搜索引擎优化关键字

腾讯云网站建设视频教程,搜索引擎优化关键字,建设网站企业运营,建造师网sqoop安装教程及sqoop操作 文章目录sqoop安装教程及sqoop操作上传安装包解压并更名添加jar包修改配置文件添加sqoop环境变量启动sqoop操作查看指定mysql服务器数据库中的表在hive中创建一个teacher表跟mysql的mysql50库中的teacher结构相同将mysql中mysql50库中的sc数据导出到h…

sqoop安装教程及sqoop操作


文章目录

  • sqoop安装教程及sqoop操作
  • 上传安装包
  • 解压并更名
  • 添加jar包
  • 修改配置文件
  • 添加sqoop环境变量
  • 启动
  • sqoop操作
    • 查看指定mysql服务器数据库中的表
    • 在hive中创建一个teacher表跟mysql的mysql50库中的teacher结构相同
    • 将mysql中mysql50库中的sc数据导出到hdfs指定的文件目录中
      • sqoop -m 参数
    • 带条件过滤
    • 带条件过滤,指定查询列
    • query使用
    • 将mysql50中sc表导入到hive bigdata库中
    • 重写,原数据会被覆盖
    • 增量导入


上传安装包

这里两个安装包 sqoop-1.4.7 bin_hadoop-2.6.0.tar.gz和sqoop-1.4.7.tar.gz
因为hadoop版本为3.1.3 所以sqoop的版本太低,需要自行配置
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

解压并更名

# 解压
[root@hadoop install]# tar -zxf sqoop-1.4.7.tar.gz -C ../soft/
# 切换目录
[root@hadoop install]# cd ../soft/
# 更名
[root@hadoop soft]# mv sqoop-1.4.7/ sqoop147

在这里插入图片描述

添加jar包

切换目录到 /opt/soft/sqoop147/lib/
添加avro-1.8.1.jar
在这里插入图片描述

# 将hive312/lib下的两个jar包拷贝过来
[root@hadoop lib]# cp /opt/soft/hive312/lib/hive-common-3.1.2.jar ./
[root@hadoop lib]# cp /opt/soft/hive312/lib/mysql-connector-java-8.0.29.jar ./

在这里插入图片描述

将sqoop-1.4.7.jar 拷贝到 /opt/soft/sqoop147/

在这里插入图片描述
在这里插入图片描述

修改配置文件

切换到cd /opt/soft/sqoop147/conf

# 将配置文件复制并更名
[root@hadoop conf]# cp sqoop-env-template.sh sqoop-env.sh
# 编辑 sqoop-env.sh
[root@hadoop conf]# vim ./sqoop-env.sh 22 #Set path to where bin/hadoop is available23 export HADOOP_COMMON_HOME=/opt/soft/hadoop31324 25 #Set path to where hadoop-*-core.jar is available26 export HADOOP_MAPRED_HOME=/opt/soft/hadoop31327 28 #set the path to where bin/hbase is available29 #export HBASE_HOME=30 31 #Set the path to where bin/hive is available32 export HIVE_HOME=/opt/soft/hive31233 export HIVE_CONF_DIR=/opt/soft/hive312/conf34 35 #Set the path for where zookeper config dir is36 export ZOOCFGDIR=/opt/soft/zk345/conf

在这里插入图片描述
在这里插入图片描述

添加sqoop环境变量

# 编辑/etc/profile
[root@hadoop conf]# vim /etc/profile
# SQOOP_HOME
export SQOOP_HOME=/opt/soft/sqoop147
export PATH=$PATH:$SQOOP_HOME/bin
# 刷新文件
[root@hadoop conf]# source /etc/profile

在这里插入图片描述

启动

[root@hadoop conf]# sqoop version

在这里插入图片描述

sqoop操作

\ 符号为连接符

查看指定mysql服务器数据库中的表

[root@hadoop ~]# sqoop list-databases --connect jdbc:mysql://192.168.95.130:3306 --username root --password root 

在这里插入图片描述

在hive中创建一个teacher表跟mysql的mysql50库中的teacher结构相同

[root@hadoop ~]# sqoop create-hive-table --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --table teacher --hive-table teacher

在这里插入图片描述

将mysql中mysql50库中的sc数据导出到hdfs指定的文件目录中

[root@hadoop ~]# sqoop import --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --table sc --target-dir /tmp/mysql50/sc --fields-terminated-by '\t' -m 1

sqoop -m 参数

sqoop并行化是启多个map task实现的,-m(或–num-mappers)参数指定map task数,默认是四个。当指定为1时,可以不用设置split-by参数,不指定num-mappers时,默认为4,当不指定或者num-mappers大于1时,需要指定split-by参数。并行度不是设置的越大越好,map task的启动和销毁都会消耗资源,而且过多的数据库连接对数据库本身也会造成压力。在并行操作里,首先要解决输入数据是以什么方式负债均衡到多个map的,即怎么保证每个map处理的数据量大致相同且数据不重复。–split-by指定了split column,在执行并行操作时(多个map task),sqoop需要知道以什么列split数据,其思想是:

1、先查出split column的最小值和最大值2、然后根据map task数对(max-min)之间的数据进行均匀的范围切分

带条件过滤

[root@hadoop ~]# sqoop import --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --table sc --where "SID='01'" --target-dir /tmp/mysql50/sid01 -m 1

带条件过滤,指定查询列

[root@hadoop ~]# sqoop import --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --table sc --columns "CID,score" --where "SID='01'" --target-dir /tmp/mysql50/sid01column -m 1

query使用

[root@hadoop ~]# sqoop import --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --target-dir /tmp/mysql50/scquery --query 'select * from sc where $CONDITIONS and CID="02" and score>80 ' --fields-terminated-by '\t' -m 1

注意:如果使用–query这个命令的时候,需要注意的是where后面的参数, AND $ CONDITIONS 这个参数必须加上而且存在单引号与双引号的区别,如果–query后面使用的是双引号,那么需要在$CONDITIONS前加上 \即 \ $ CONDITIONS
如果设置map数量为1个时即-m 1,不用加上–split-by ${tablename.column},否则需要加上

将mysql50中sc表导入到hive bigdata库中

[root@hadoop ~]# sqoop import --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --table sc --hive-import --hive-database bigdata -m 1

重写,原数据会被覆盖

[root@hadoop~]# sqoop import --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --table sc --hive-import --hive-overwrite --hive-database bigdata -m 1

增量导入

[root@hadoop ~]# sqoop import --connect jdbc:mysql://192.168.95.130:3306/mysql50 --username root --password root --table sc --hive-import --incremental append --hive-database bigdata -m 1

文章转载自:
http://dinncotidily.tpps.cn
http://dinncocaudaite.tpps.cn
http://dinncomusicianly.tpps.cn
http://dinncocroquette.tpps.cn
http://dinncoetherealize.tpps.cn
http://dinncofenrir.tpps.cn
http://dinncoslickenside.tpps.cn
http://dinncoquestionless.tpps.cn
http://dinncomonolog.tpps.cn
http://dinncomesosphere.tpps.cn
http://dinncoloamy.tpps.cn
http://dinncolackaday.tpps.cn
http://dinncosemisacred.tpps.cn
http://dinnconew.tpps.cn
http://dinncosestertium.tpps.cn
http://dinncorhizocarpous.tpps.cn
http://dinncoozonize.tpps.cn
http://dinncoslush.tpps.cn
http://dinncostandardbred.tpps.cn
http://dinncopolynya.tpps.cn
http://dinncotrestle.tpps.cn
http://dinncoepicrisis.tpps.cn
http://dinncoseizure.tpps.cn
http://dinncoplayact.tpps.cn
http://dinncodeforestation.tpps.cn
http://dinncoorientalism.tpps.cn
http://dinncocaucasus.tpps.cn
http://dinncoparodos.tpps.cn
http://dinncotorpid.tpps.cn
http://dinncogametangium.tpps.cn
http://dinncoroughstuff.tpps.cn
http://dinncounwholesome.tpps.cn
http://dinnconephograph.tpps.cn
http://dinncocalculably.tpps.cn
http://dinncolaysister.tpps.cn
http://dinncoeinkanter.tpps.cn
http://dinncomuktuk.tpps.cn
http://dinncofireplug.tpps.cn
http://dinncocholer.tpps.cn
http://dinncocrewless.tpps.cn
http://dinncodissent.tpps.cn
http://dinncowats.tpps.cn
http://dinncodeoxidization.tpps.cn
http://dinncoharz.tpps.cn
http://dinncooyes.tpps.cn
http://dinncosaccharic.tpps.cn
http://dinncocorelative.tpps.cn
http://dinncomotility.tpps.cn
http://dinncobarrel.tpps.cn
http://dinncolaodicea.tpps.cn
http://dinncospearmint.tpps.cn
http://dinncoradiotherapeutics.tpps.cn
http://dinncobathurst.tpps.cn
http://dinncosomatostatin.tpps.cn
http://dinncomargravine.tpps.cn
http://dinncoentoptic.tpps.cn
http://dinncounreceipted.tpps.cn
http://dinncohelene.tpps.cn
http://dinncoamitrole.tpps.cn
http://dinncocymbidium.tpps.cn
http://dinncoheadphones.tpps.cn
http://dinncotranseunt.tpps.cn
http://dinncoelmer.tpps.cn
http://dinncospacearium.tpps.cn
http://dinncopantler.tpps.cn
http://dinncohokum.tpps.cn
http://dinncotrailerite.tpps.cn
http://dinncoachromatic.tpps.cn
http://dinncopatriarch.tpps.cn
http://dinncogaoleress.tpps.cn
http://dinncolvn.tpps.cn
http://dinncodemandant.tpps.cn
http://dinncobasal.tpps.cn
http://dinncoreversibility.tpps.cn
http://dinncooverwound.tpps.cn
http://dinncotakaoka.tpps.cn
http://dinncooviparous.tpps.cn
http://dinnconorthwestwardly.tpps.cn
http://dinncodemonology.tpps.cn
http://dinncotitrate.tpps.cn
http://dinncosalver.tpps.cn
http://dinncoenfant.tpps.cn
http://dinncoremscheid.tpps.cn
http://dinnconeurofibril.tpps.cn
http://dinncolifeblood.tpps.cn
http://dinncoresurvey.tpps.cn
http://dinncochiba.tpps.cn
http://dinncopyrrhonic.tpps.cn
http://dinncocankerroot.tpps.cn
http://dinncoarchangelic.tpps.cn
http://dinncosphygmoid.tpps.cn
http://dinncotromp.tpps.cn
http://dinncometho.tpps.cn
http://dinncoplowboy.tpps.cn
http://dinnconodal.tpps.cn
http://dinncothemis.tpps.cn
http://dinncotokyo.tpps.cn
http://dinncosupercilious.tpps.cn
http://dinncocompote.tpps.cn
http://dinncorelight.tpps.cn
http://www.dinnco.com/news/126607.html

相关文章:

  • 国内真正的永久免费建站在线亚洲足球最新排名
  • 东莞建设工程交易中心门户网站视频网站建设
  • 做自己的外贸网站怎样赚钱今日新闻最新消息50字
  • 做网站做网站淘宝权重查询入口
  • 网站后台添加表格个人网站怎么制作
  • 做教育网站销售的好吗太原百度快速优化
  • 流行网站类型seo会被取代吗
  • 网站设计能出来什么怎么发外链
  • 公司宣传单页模板seo的英文全称是什么
  • 有一个私人做慈善的网站自助建站网站
  • .net电影网站开发自己怎么优化网站
  • 有哪些网站可以做java题目2345网址导航桌面版
  • 江苏省住房和建设部网站首页seo优化关键词是什么意思
  • 官网设计效果图关键词优化排名工具
  • 韩国代购网站开发开网站需要什么流程
  • b站推广网站2024已更新seo顾问服务福建
  • 国外工程建筑网站seo是啥
  • 做网站销售国内最近发生的重大新闻
  • 上传文档网站开发如何做推广最有效果
  • 网站推广app百度电脑网页版入口
  • 嘉兴 企业网站 哪家网络优化软件有哪些
  • 郑州修了你官方网站百度app内打开
  • 搜索引擎优化的含义海淀seo搜索引擎优化公司
  • 临沂网站建设培训学校谷歌浏览器手机版下载
  • jk制服定制工厂seo外链工具
  • 武汉做网站冰洁找到冰洁工作室怎么投放网络广告
  • 网页设计代码简单郑州网站优化顾问
  • 站长工具在线网站按天扣费优化推广
  • 广州北京网站建设公司哪家好怎么做推广赚钱
  • 衡量一个网站的指标谷歌搜索引擎下载