暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

关于DataX和DataX Web step by step安装部署

709

DataX 是阿里开源的一个异构数据源离线同步工具,致力于实现包括关系型数据库(MySQL、Oracle等)、HDFS、Hive、ODPS、HBase、FTP等各种异构数据源之间稳定高效的数据同步功能。

DataX Web是在DataX之上开发的分布式数据同步工具,提供简单易用的 操作界面,降低用户使用DataX的学习成本,缩短任务配置时间,避免配置过程中出错。用户可通过页面选择数据源即可创建数据同步任务,支持RDBMS、Hive、HBase、ClickHouse、MongoDB等数据源,RDBMS数据源可批量创建数据同步任务,支持实时查看数据同步进度及日志并提供终止同步功能,集成并二次开发xxl-job可根据时间、自增主键增量同步数据。

但DataX Web很久没更新了,真是可惜!

本文只是一个step by step安装文档,后续使用过程有机会再分项

一、安装DataX

1、安装java

  1. 下载jdk解压到/usr/local/java/

  2. [root@localhost local]# mkdir java

  3. [root@localhost ~]# tar -zxvf /root/jdk-8u261-linux-x64.tar.gz -C /usr/local/java/


  4. [root@localhost ~]# vi /etc/profile

  5. export JAVA_HOME=/usr/local/java/jdk1.8.0_261

  6. export PATH=$JAVA_HOME/bin:$PATH

  7. export CLAsspATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

  8. export CANAL_SERVER_HOME=/usr/local/canal/deployer

  9. export PATH=$CANAL_SERVER_HOME/bin:$PATH



  10. [root@localhost ~]# source /etc/profile

  11. [root@localhost ~]# java -version

  12. java version "1.8.0_261"

  13. Java(TM) SE Runtime Environment (build 1.8.0_261-b12)

  14. Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

2、下载datax

可能遭遇wget:command Not found的情况

  1. [root@localhost ~]# wget http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz

  2. -bash: wget: command not found


  3. [root@localhost ~]# yum install -y wget

  4. Loaded plugins: fastestmirror

  5. Determining fastest mirrors

  6. * base: mirrors.ustc.edu.cn

  7. * extras: mirrors.ustc.edu.cn

  8. * updates: mirrors.ustc.edu.cn

  9. base | 3.6 kB 00:00:00

  10. extras | 2.9 kB 00:00:00

  11. updates | 2.9 kB 00:00:00

  12. (1/3): extras/7/x86_64/primary_db | 249 kB 00:00:01

  13. (2/3): base/7/x86_64/primary_db | 6.1 MB 00:00:16

  14. (3/3): updates/7/x86_64/primary_db | 20 MB 00:00:55

  15. Resolving Dependencies

  16. --> Running transaction check

  17. ---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed

  18. --> Finished Dependency Resolution


  19. Dependencies Resolved


  20. ====================================================================================

  21. Package Arch Version Repository Size

  22. ====================================================================================

  23. Installing:

  24. wget x86_64 1.14-18.el7_6.1 base 547 k


  25. Transaction Summary

  26. ====================================================================================

  27. Install 1 Package


  28. Total download size: 547 k

  29. Installed size: 2.0 M

  30. Downloading packages:

  31. wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00

  32. Running transaction check

  33. Running transaction test

  34. Transaction test succeeded

  35. Running transaction

  36. Installing : wget-1.14-18.el7_6.1.x86_64 1/1

  37. Verifying : wget-1.14-18.el7_6.1.x86_64 1/1


  38. Installed:

  39. wget.x86_64 0:1.14-18.el7_6.1


  40. Complete!

  41. [root@localhost ~]# wget http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz

  42. --2023-03-13 10:15:04-- http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz

  43. Resolving datax-opensource.oss-cn-hangzhou.aliyuncs.com (datax-opensource.oss-cn-hangzhou.aliyuncs.com)... 47.110.177.8

  44. Connecting to datax-opensource.oss-cn-hangzhou.aliyuncs.com (datax-opensource.oss-cn-hangzhou.aliyuncs.com)|47.110.177.8|:80... connected.

  45. HTTP request sent, awaiting response... 200 OK

  46. Length: 853734462 (814M) [application/gzip]

  47. Saving to: datax.tar.gz


  48. 100%[=================================================================================================================>] 853,734,462 2.22MB/s in 5m 52s


  49. 2023-03-13 10:21:01 (2.31 MB/s) - datax.tar.gz saved [853734462/853734462]

3、安装python3

  1. [root@localhost ~]# python --version

  2. Python 2.7.5


  3. [root@localhost local]# mkdir python3

  4. [root@localhost local]# tar -xvJf /root/Python-3.9.9.tar.xz -C /usr/local/python3/

  5. Python-3.9.9/

  6. Python-3.9.9/Python/

  7. ...

  8. Python-3.9.9/setup.py


  9. [root@localhost local]# cd /usr/local/python3/

  10. [root@localhost python3]# cd Python-3.9.9/

  11. [root@localhost Python-3.9.9]# ./configure --prefix=/usr/local/python3

  12. checking build system type... x86_64-pc-linux-gnu

  13. checking host system type... x86_64-pc-linux-gnu

  14. ...

  15. creating Makefile



  16. If you want a release build with all stable optimizations active (PGO, etc),

  17. please run ./configure --enable-optimizations



  18. [root@localhost Python-3.9.9]# make && make install

  19. gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c

  20. gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c

  21. Traceback (most recent call last):

  22. File "<frozen zipimport>", line 520, in _get_decompress_func

  23. ModuleNotFoundError: No module named 'zlib'

  24. During handling of the above exception, another exception occurred:

  25. Traceback (most recent call last):

  26. File "<frozen zipimport>", line 568, in _get_data

  27. File "<frozen zipimport>", line 523, in _get_decompress_func

  28. zipimport.ZipImportError: can't decompress data; zlib not available

  29. During handling of the above exception, another exception occurred:

  30. ...

  31. raise CalledProcessError(retcode, process.args,

  32. subprocess.CalledProcessError: Command '['/usr/local/python3/Python-3.9.9/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpyno8zwc7/setuptools-58.1.0-py3-none-any.whl\', \'/tmp/tmpyno8zwc7/pip-21.2.4-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpyno8zwc7\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.


  33. [root@localhost Python-3.9.9]# yum install gcc -y

  34. [root@localhost Python-3.9.9]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

  35. [root@localhost Python-3.9.9]# yum install zlib zlib-devel openssl -y

  36. [root@localhost Python-3.9.9]# yum install openssl-devel -y

  37. [root@localhost Python-3.9.9]# yum install libffi-devel -y


  38. [root@localhost Python-3.9.9]# ./configure --prefix=/usr/local/python3

  39. checking build system type... x86_64-pc-linux-gnu

  40. checking host system type... x86_64-pc-linux-gnu

  41. ...

  42. creating Makefile



  43. If you want a release build with all stable optimizations active (PGO, etc),

  44. please run ./configure --enable-optimizations



  45. [root@localhost Python-3.9.9]# make && make install

  46. Successfully installed pip-21.2.4 setuptools-58.1.0

  47. WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv


  48. [root@localhost Python-3.9.9]# python3

  49. Python 3.9.9 (main, Mar 13 2023, 11:27:42)

  50. [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux

  51. Type "help", "copyright", "credits" or "license" for more information.

  52. >>>

  53. [2]+ Stopped python3

  54. [root@localhost Python-3.9.9]# pip3 --version

  55. pip 21.2.4 from /usr/local/python3/lib/python3.9/site-packages/pip (python 3.9)

  56. [root@localhost Python-3.9.9]#

4、DataX安装

  1. [root@localhost ~]# tar zxf datax.tar.gz -C /usr/local/

  2. [root@localhost ~]# rm -rf /usr/local/datax/plugin/*/._*

  3. # 下载https://github.com/WeiYe-Jing/datax-web的三个py文件

  4. # datax\datax-web\doc\datax-web\datax-python3\datax.py,dxprof.py,perftrace.py

  5. # 复制到/usr/local/datax/bin目录下

  6. [root@localhost ~]# cp *.py usr/local/datax/bin


  7. [root@localhost bin]# python3 datax.py ../job/job.json


  8. DataX (DATAX-OPENSOURCE-3.0), From Alibaba !

  9. Copyright (C) 2010-2017, Alibaba Group. All Rights Reserved.



  10. 2023-03-13 12:15:48.740 [main] INFO VMInfo - VMInfo# operatingSystem class => sun.management.OperatingSystemImpl

  11. 2023-03-13 12:15:48.746 [main] INFO Engine - the machine info =>


  12. osInfo: Oracle Corporation 1.8 25.261-b12

  13. jvmInfo: Linux amd64 3.10.0-957.el7.x86_64

  14. cpu num: 4


  15. totalPhysicalMemory: -0.00G

  16. freePhysicalMemory: -0.00G

  17. maxFileDescriptorCount: -1

  18. currentOpenFileDescriptorCount: -1


  19. GC Names [PS MarkSweep, PS Scavenge]


  20. MEMORY_NAME | allocation_size | init_size

  21. PS Eden Space | 256.00MB | 256.00MB

  22. Code Cache | 240.00MB | 2.44MB

  23. Compressed Class Space | 1,024.00MB | 0.00MB

  24. PS Survivor Space | 42.50MB | 42.50MB

  25. PS Old Gen | 683.00MB | 683.00MB

  26. Metaspace | -0.00MB | 0.00MB



  27. 2023-03-13 12:15:48.761 [main] INFO Engine -

  28. {

  29. "content":[

  30. {

  31. "reader":{

  32. "name":"streamreader",

  33. "parameter":{

  34. "column":[

  35. {

  36. "type":"string",

  37. "value":"DataX"

  38. },

  39. {

  40. "type":"long",

  41. "value":19890604

  42. },

  43. {

  44. "type":"date",

  45. "value":"1989-06-04 00:00:00"

  46. },

  47. {

  48. "type":"bool",

  49. "value":true

  50. },

  51. {

  52. "type":"bytes",

  53. "value":"test"

  54. }

  55. ],

  56. "sliceRecordCount":100000

  57. }

  58. },

  59. "writer":{

  60. "name":"streamwriter",

  61. "parameter":{

  62. "encoding":"UTF-8",

  63. "print":false

  64. }

  65. }

  66. }

  67. ],

  68. "setting":{

  69. "errorLimit":{

  70. "percentage":0.02,

  71. "record":0

  72. },

  73. "speed":{

  74. "byte":10485760

  75. }

  76. }

  77. }


  78. 2023-03-13 12:15:48.777 [main] WARN Engine - prioriy set to 0, because NumberFormatException, the value is: null

  79. 2023-03-13 12:15:48.779 [main] INFO PerfTrace - PerfTrace traceId=job_-1, isEnable=false, priority=0

  80. 2023-03-13 12:15:48.780 [main] INFO JobContainer - DataX jobContainer starts job.

  81. 2023-03-13 12:15:48.784 [main] INFO JobContainer - Set jobId = 0

  82. 2023-03-13 12:15:48.809 [job-0] INFO JobContainer - jobContainer starts to do prepare ...

  83. 2023-03-13 12:15:48.809 [job-0] INFO JobContainer - DataX Reader.Job [streamreader] do prepare work .

  84. 2023-03-13 12:15:48.810 [job-0] INFO JobContainer - DataX Writer.Job [streamwriter] do prepare work .

  85. 2023-03-13 12:15:48.810 [job-0] INFO JobContainer - jobContainer starts to do split ...

  86. 2023-03-13 12:15:48.811 [job-0] INFO JobContainer - Job set Max-Byte-Speed to 10485760 bytes.

  87. 2023-03-13 12:15:48.811 [job-0] INFO JobContainer - DataX Reader.Job [streamreader] splits to [1] tasks.

  88. 2023-03-13 12:15:48.812 [job-0] INFO JobContainer - DataX Writer.Job [streamwriter] splits to [1] tasks.

  89. 2023-03-13 12:15:48.830 [job-0] INFO JobContainer - jobContainer starts to do schedule ...

  90. 2023-03-13 12:15:48.835 [job-0] INFO JobContainer - Scheduler starts [1] taskGroups.

  91. 2023-03-13 12:15:48.837 [job-0] INFO JobContainer - Running by standalone Mode.

  92. 2023-03-13 12:15:48.849 [taskGroup-0] INFO TaskGroupContainer - taskGroupId=[0] start [1] channels for [1] tasks.

  93. 2023-03-13 12:15:48.857 [taskGroup-0] INFO Channel - Channel set byte_speed_limit to -1, No bps activated.

  94. 2023-03-13 12:15:48.858 [taskGroup-0] INFO Channel - Channel set record_speed_limit to -1, No tps activated.

  95. 2023-03-13 12:15:48.871 [taskGroup-0] INFO TaskGroupContainer - taskGroup[0] taskId[0] attemptCount[1] is started

  96. 2023-03-13 12:15:49.272 [taskGroup-0] INFO TaskGroupContainer - taskGroup[0] taskId[0] is successed, used[402]ms

  97. 2023-03-13 12:15:49.274 [taskGroup-0] INFO TaskGroupContainer - taskGroup[0] completed it's tasks.

  98. 2023-03-13 12:15:58.852 [job-0] INFO StandAloneJobContainerCommunicator - Total 100000 records, 2600000 bytes | Speed 253.91KB/s, 10000 records/s | Error 0 records, 0 bytes | All Task WaitWriterTime 0.054s | All Task WaitReaderTime 0.062s | Percentage 100.00%

  99. 2023-03-13 12:15:58.853 [job-0] INFO AbstractScheduler - Scheduler accomplished all tasks.

  100. 2023-03-13 12:15:58.854 [job-0] INFO JobContainer - DataX Writer.Job [streamwriter] do post work.

  101. 2023-03-13 12:15:58.855 [job-0] INFO JobContainer - DataX Reader.Job [streamreader] do post work.

  102. 2023-03-13 12:15:58.855 [job-0] INFO JobContainer - DataX jobId [0] completed successfully.

  103. 2023-03-13 12:15:58.857 [job-0] INFO HookInvoker - No hook invoked, because base dir not exists or is a file: usr/local/datax/hook

  104. 2023-03-13 12:15:58.859 [job-0] INFO JobContainer -

  105. [total cpu info] =>

  106. averageCpu | maxDeltaCpu | minDeltaCpu

  107. -1.00% | -1.00% | -1.00%



  108. [total gc info] =>

  109. NAME | totalGCCount | maxDeltaGCCount | minDeltaGCCount | totalGCTime | maxDeltaGCTime | minDeltaGCTime

  110. PS MarkSweep | 0 | 0 | 0 | 0.000s | 0.000s | 0.000s

  111. PS Scavenge | 0 | 0 | 0 | 0.000s | 0.000s | 0.000s


  112. 2023-03-13 12:15:58.859 [job-0] INFO JobContainer - PerfTrace not enable!

  113. 2023-03-13 12:15:58.860 [job-0] INFO StandAloneJobContainerCommunicator - Total 100000 records, 2600000 bytes | Speed 253.91KB/s, 10000 records/s | Error 0 records, 0 bytes | All Task WaitWriterTime 0.054s | All Task WaitReaderTime 0.062s | Percentage 100.00%

  114. 2023-03-13 12:15:58.861 [job-0] INFO JobContainer -

  115. 任务启动时刻 : 2023-03-13 12:15:48

  116. 任务结束时刻 : 2023-03-13 12:15:58

  117. 任务总计耗时 : 10s

  118. 任务平均流量 : 253.91KB/s

  119. 记录写入速度 : 10000rec/s

  120. 读出记录总数 : 100000

  121. 读写失败总数 : 0

5、生成数据导入导出模板,并修改后执行

  1. [root@localhost bin]# python3 datax.py -r mysqlreader -w postgresqlwriter > myjob.json



  2. [root@localhost bin]# vi myjob.json

  3. {

  4. "job": {

  5. "content": [

  6. {

  7. "reader": {

  8. "name": "mysqlreader",

  9. "parameter": {

  10. "column": ["id","name"],

  11. "connection": [

  12. {

  13. "jdbcUrl":["jdbc:mysql://*.*.*.*:3306/testdb?characterEncoding=utf8"],

  14. "table": ["aaa"]

  15. }

  16. ],

  17. "password": "xxxxxx",

  18. "username": "root",

  19. "where": ""

  20. }

  21. },

  22. "writer": {

  23. "name": "postgresqlwriter",

  24. "parameter": {

  25. "column": ["id","name"],

  26. "connection": [

  27. {

  28. "jdbcUrl": "jdbc:postgresql://*.*.*.*:5432/testdb",

  29. "table": ["aaa_sync"]

  30. }

  31. ],

  32. "password": "xxxxxx",

  33. "postSql": [],

  34. "preSql": [],

  35. "username": "postgres"

  36. }

  37. }

  38. }

  39. ],

  40. "setting": {

  41. "speed": {

  42. "channel": "3"

  43. }

  44. }

  45. }

  46. }


  47. [root@localhost bin]# python3 datax.py myjob.json

  48. ...

  49. 2023-03-13 12:48:00.222 [job-0] INFO JobContainer - PerfTrace not enable!

  50. 2023-03-13 12:48:00.223 [job-0] INFO StandAloneJobContainerCommunicator - Total 22 records, 268 bytes | Speed 26B/s, 2 records/s | Error 0 records, 0 bytes | All Task WaitWriterTime 0.000s | All Task WaitReaderTime 0.000s | Percentage 100.00%

  51. 2023-03-13 12:48:00.224 [job-0] INFO JobContainer -

  52. 任务启动时刻 : 2023-03-13 12:47:49

  53. 任务结束时刻 : 2023-03-13 12:48:00

  54. 任务总计耗时 : 10s

  55. 任务平均流量 : 26B/s

  56. 记录写入速度 : 2rec/s

  57. 读出记录总数 : 22

  58. 读写失败总数 : 0

6、mysql安装代码示例

  1. [root@localhost ~]# rpm -qa | grep mysql

  2. [root@localhost ~]# rpm -qa | grep -i mariadb

  3. mariadb-libs-5.5.60-1.el7_5.x86_64

  4. [root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64

  5. [root@localhost ~]# rpm -qa | grep mysql

  6. [root@localhost ~]# rpm -qa | grep -i mariadb

  7. [root@localhost ~]# rm -rf ./etc/my.cnf

  8. [root@localhost ~]# rm -rf ./etc/lib/mysql




  9. [root@localhost ~]# rpm -qa | grep -i mysql

  10. mysql57-community-release-el7-8.noarch

  11. [root@localhost ~]# yum remove mysql57-community-release-el7-8.noarch

  12. Loaded plugins: fastestmirror

  13. Resolving Dependencies

  14. --> Running transaction check

  15. ---> Package mysql57-community-release.noarch 0:el7-8 will be erased

  16. --> Finished Dependency Resolution


  17. Dependencies Resolved


  18. ===========================================================================================================================================================

  19. Package Arch Version Repository Size

  20. ===========================================================================================================================================================

  21. Removing:

  22. mysql57-community-release noarch el7-8 installed 8.2 k


  23. Transaction Summary

  24. ===========================================================================================================================================================

  25. Remove 1 Package


  26. Installed size: 8.2 k

  27. Is this ok [y/N]: y

  28. Downloading packages:

  29. Running transaction check

  30. Running transaction test

  31. Transaction test succeeded

  32. Running transaction

  33. Warning: RPMDB altered outside of yum.

  34. ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:

  35. 2:postfix-2.10.1-7.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)

  36. 2:postfix-2.10.1-7.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)

  37. Erasing : mysql57-community-release-el7-8.noarch 1/1

  38. Verifying : mysql57-community-release-el7-8.noarch 1/1


  39. Removed:

  40. mysql57-community-release.noarch 0:el7-8


  41. Complete!

  42. [root@localhost ~]# rpm -qa | grep -i mysql


  43. [root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm

  44. Loaded plugins: fastestmirror

  45. Examining mysql57-community-release-el7-10.noarch.rpm: mysql57-community-release-el7-10.noarch

  46. Marking mysql57-community-release-el7-10.noarch.rpm to be installed

  47. Resolving Dependencies

  48. --> Running transaction check

  49. ---> Package mysql57-community-release.noarch 0:el7-10 will be installed

  50. --> Finished Dependency Resolution


  51. Dependencies Resolved


  52. ===========================================================================================================================================================

  53. Package Arch Version Repository Size

  54. ===========================================================================================================================================================

  55. Installing:

  56. mysql57-community-release noarch el7-10 /mysql57-community-release-el7-10.noarch 30 k


  57. Transaction Summary

  58. ===========================================================================================================================================================

  59. Install 1 Package


  60. Total size: 30 k

  61. Installed size: 30 k

  62. Downloading packages:

  63. Running transaction check

  64. Running transaction test

  65. Transaction test succeeded

  66. Running transaction

  67. Installing : mysql57-community-release-el7-10.noarch 1/1

  68. Verifying : mysql57-community-release-el7-10.noarch 1/1


  69. Installed:

  70. mysql57-community-release.noarch 0:el7-10


  71. Complete!

  72. [root@localhost ~]# yum -y install mysql-community-server

  73. Loaded plugins: fastestmirror

  74. Loading mirror speeds from cached hostfile

  75. * base: mirrors.ustc.edu.cn

  76. * extras: mirrors.ustc.edu.cn

  77. * updates: mirrors.ustc.edu.cn

  78. Resolving Dependencies

  79. --> Running transaction check

  80. ---> Package mysql-community-server.x86_64 0:5.7.41-1.el7 will be installed

  81. --> Processing Dependency: mysql-community-common(x86-64) = 5.7.41-1.el7 for package: mysql-community-server-5.7.41-1.el7.x86_64

  82. --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.41-1.el7.x86_64

  83. --> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.7.41-1.el7.x86_64

  84. --> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.7.41-1.el7.x86_64

  85. --> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.7.41-1.el7.x86_64

  86. --> Running transaction check

  87. ---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed

  88. ---> Package mysql-community-client.x86_64 0:5.7.41-1.el7 will be installed

  89. --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.41-1.el7.x86_64

  90. ---> Package mysql-community-common.x86_64 0:5.7.41-1.el7 will be installed

  91. --> Running transaction check

  92. ---> Package mysql-community-libs.x86_64 0:5.7.41-1.el7 will be installed

  93. --> Finished Dependency Resolution


  94. Dependencies Resolved


  95. ===========================================================================================================================================================

  96. Package Arch Version Repository Size

  97. ===========================================================================================================================================================

  98. Installing:

  99. mysql-community-server x86_64 5.7.41-1.el7 mysql57-community 178 M

  100. Installing for dependencies:

  101. libaio x86_64 0.3.109-13.el7 base 24 k

  102. mysql-community-client x86_64 5.7.41-1.el7 mysql57-community 28 M

  103. mysql-community-common x86_64 5.7.41-1.el7 mysql57-community 311 k

  104. mysql-community-libs x86_64 5.7.41-1.el7 mysql57-community 2.6 M


  105. Transaction Summary

  106. ===========================================================================================================================================================

  107. Install 1 Package (+4 Dependent packages)


  108. Total size: 209 M

  109. Installed size: 895 M

  110. Downloading packages:

  111. Running transaction check

  112. Running transaction test

  113. Transaction test succeeded

  114. Running transaction

  115. Installing : mysql-community-common-5.7.41-1.el7.x86_64 1/5

  116. Installing : mysql-community-libs-5.7.41-1.el7.x86_64 2/5

  117. Installing : mysql-community-client-5.7.41-1.el7.x86_64 3/5

  118. Installing : libaio-0.3.109-13.el7.x86_64 4/5

  119. Installing : mysql-community-server-5.7.41-1.el7.x86_64 5/5

  120. Verifying : mysql-community-server-5.7.41-1.el7.x86_64 1/5

  121. Verifying : libaio-0.3.109-13.el7.x86_64 2/5

  122. Verifying : mysql-community-client-5.7.41-1.el7.x86_64 3/5

  123. Verifying : mysql-community-common-5.7.41-1.el7.x86_64 4/5

  124. Verifying : mysql-community-libs-5.7.41-1.el7.x86_64 5/5


  125. Installed:

  126. mysql-community-server.x86_64 0:5.7.41-1.el7


  127. Dependency Installed:

  128. libaio.x86_64 0:0.3.109-13.el7 mysql-community-client.x86_64 0:5.7.41-1.el7 mysql-community-common.x86_64 0:5.7.41-1.el7

  129. mysql-community-libs.x86_64 0:5.7.41-1.el7


  130. Complete!

  131. [root@localhost ~]# systemctl start mysqld.service

  132. [root@localhost ~]# systemctl status mysqld.service

  133. mysqld.service - MySQL Server

  134. Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

  135. Active: active (running) since Mon 2023-03-13 15:43:21 CST; 10s ago

  136. Docs: man:mysqld(8)

  137. http://dev.mysql.com/doc/refman/en/using-systemd.html

  138. Process: 4620 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)

  139. Process: 4565 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

  140. Main PID: 4623 (mysqld)

  141. CGroup: /system.slice/mysqld.service

  142. └─4623 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid


  143. Mar 13 15:43:15 localhost.localdomain systemd[1]: Starting MySQL Server...

  144. Mar 13 15:43:21 localhost.localdomain systemd[1]: Started MySQL Server.

二、安装DataX Web

1、安装和配置mysql

  1. [root@localhost ~]# grep "password" /var/log/mysqld.log

  2. 2023-03-13T07:43:17.448189Z 1 [Note] A temporary password is generated for root@localhost: RtSqv=uP(0jR

  3. [root@localhost ~]# mysql -uroot -p

  4. Enter password:

  5. Welcome to the MySQL monitor. Commands end with ; or \g.

  6. Your MySQL connection id is 2

  7. Server version: 5.7.41


  8. Copyright (c) 2000, 2023, Oracle and/or its affiliates.


  9. Oracle is a registered trademark of Oracle Corporation and/or its

  10. affiliates. Other names may be trademarks of their respective

  11. owners.


  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


  13. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxx';

  14. Query OK, 0 rows affected (0.01 sec)


  15. mysql>

  16. [3]+ Stopped mysql -uroot -p


  17. [root@localhost ~]# mysql -uroot -p

  18. Enter password:

  19. Welcome to the MySQL monitor. Commands end with ; or \g.

  20. Your MySQL connection id is 6

  21. Server version: 5.7.41 MySQL Community Server (GPL)


  22. Copyright (c) 2000, 2023, Oracle and/or its affiliates.


  23. Oracle is a registered trademark of Oracle Corporation and/or its

  24. affiliates. Other names may be trademarks of their respective

  25. owners.


  26. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.



  27. mysql> show database

  28. -> ;

  29. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1

  30. mysql> show databases;

  31. +--------------------+

  32. | Database |

  33. +--------------------+

  34. | information_schema |

  35. | mysql |

  36. | performance_schema |

  37. | sys |

  38. +--------------------+

  39. 4 rows in set (0.00 sec)


  40. mysql> use mysql;

  41. Reading table information for completion of table and column names

  42. You can turn off this feature to get a quicker startup with -A


  43. Database changed

  44. mysql> show tables;

  45. +---------------------------+

  46. | Tables_in_mysql |

  47. +---------------------------+

  48. | columns_priv |

  49. | db |

  50. | engine_cost |

  51. | event |

  52. | func |

  53. | general_log |

  54. | gtid_executed |

  55. | help_category |

  56. | help_keyword |

  57. | help_relation |

  58. | help_topic |

  59. | innodb_index_stats |

  60. | innodb_table_stats |

  61. | ndb_binlog_index |

  62. | plugin |

  63. | proc |

  64. | procs_priv |

  65. | proxies_priv |

  66. | server_cost |

  67. | servers |

  68. | slave_master_info |

  69. | slave_relay_log_info |

  70. | slave_worker_info |

  71. | slow_log |

  72. | tables_priv |

  73. | time_zone |

  74. | time_zone_leap_second |

  75. | time_zone_name |

  76. | time_zone_transition |

  77. | time_zone_transition_type |

  78. | user |

  79. +---------------------------+

  80. 31 rows in set (0.00 sec)


  81. mysql> select Host,User from user;

  82. +-----------+---------------+

  83. | Host | User |

  84. +-----------+---------------+

  85. | localhost | mysql.session |

  86. | localhost | mysql.sys |

  87. | localhost | root |

  88. +-----------+---------------+

  89. 3 rows in set (0.00 sec)


  90. mysql> update user set Host='%' where User='root';

  91. Query OK, 1 row affected (0.00 sec)

  92. Rows matched: 1 Changed: 1 Warnings: 0


  93. mysql> flush privileges;

  94. Query OK, 0 rows affected (0.00 sec)


  95. mysql> create database dataxweb;

  96. Query OK, 1 row affected (0.00 sec)


  97. mysql> show databases;

  98. +--------------------+

  99. | Database |

  100. +--------------------+

  101. | information_schema |

  102. | dataxweb |

  103. | mysql |

  104. | performance_schema |

  105. | sys |

  106. +--------------------+

  107. 5 rows in set (0.00 sec)


  108. mysql>

2、安装datax-web

  1. [root@localhost ~]# cd /usr/local

  2. [root@localhost local]# mkdir dataxweb

  3. [root@localhost ~]# tar -zxvf datax-web-2.1.2.tar.gz -C /usr/local/dataxweb

  4. datax-web-2.1.2/packages/datax-admin_2.1.2_1.tar.gz

  5. datax-web-2.1.2/packages/datax-executor_2.1.2_1.tar.gz

  6. datax-web-2.1.2/bin/

  7. datax-web-2.1.2/bin/db/

  8. datax-web-2.1.2/bin/db/datax_web.sql

  9. datax-web-2.1.2/bin/install.sh

  10. datax-web-2.1.2/bin/start-all.sh

  11. datax-web-2.1.2/bin/start.sh

  12. datax-web-2.1.2/bin/stop-all.sh

  13. datax-web-2.1.2/bin/stop.sh

  14. datax-web-2.1.2/README.md

  15. datax-web-2.1.2/userGuid.md



  16. [root@localhost /]# cd /usr/local/dataxweb/datax-web-2.1.2/bin

  17. [root@localhost bin]# ./install.sh

  18. 2023-03-13 15:55:22.429 [INFO] (5272) Creating directory: [/usr/local/dataxweb/datax-web-2.1.2/bin/../modules].

  19. 2023-03-13 15:55:22.443 [INFO] (5272) ####### Start To Uncompress Packages ######

  20. 2023-03-13 15:55:22.450 [INFO] (5272) Uncompressing....

  21. Do you want to decompress this package: [datax-admin_2.1.2_1.tar.gz]? (Y/N)y

  22. 2023-03-13 15:55:26.696 [INFO] (5272) Uncompress package: [datax-admin_2.1.2_1.tar.gz] to modules directory

  23. Do you want to decompress this package: [datax-executor_2.1.2_1.tar.gz]? (Y/N)y

  24. 2023-03-13 15:55:32.895 [INFO] (5272) Uncompress package: [datax-executor_2.1.2_1.tar.gz] to modules directory

  25. 2023-03-13 15:55:33.390 [INFO] (5272) ####### Finish To Umcompress Packages ######

  26. Scan modules directory: [/usr/local/dataxweb/datax-web-2.1.2/bin/../modules] to find server under dataxweb

  27. 2023-03-13 15:55:33.402 [INFO] (5272) ####### Start To Install Modules ######

  28. 2023-03-13 15:55:33.408 [INFO] (5272) Module servers could be installed:

  29. [datax-admin] [datax-executor]

  30. Do you want to confiugre and install [datax-admin]? (Y/N)y

  31. 2023-03-13 15:55:36.321 [INFO] (5272) Install module server: [datax-admin]

  32. Start to make directory

  33. 2023-03-13 15:55:36.371 [INFO] (5324) Start to build directory

  34. 2023-03-13 15:55:36.375 [INFO] (5324) Creating directory: [/usr/local/dataxweb/datax-web-2.1.2/modules/datax-admin/bin/../logs].

  35. 2023-03-13 15:55:36.467 [INFO] (5324) Directory or file: [/usr/local/dataxweb/datax-web-2.1.2/modules/datax-admin/bin/../conf] has been exist

  36. 2023-03-13 15:55:36.474 [INFO] (5324) Creating directory: [/usr/local/dataxweb/datax-web-2.1.2/modules/datax-admin/bin/../data].

  37. end to make directory

  38. Start to initalize database

  39. 2023-03-13 15:55:36.570 [INFO] (5324) Scan out mysql command, so begin to initalize the database

  40. Do you want to initalize database with sql: [/usr/local/dataxweb/datax-web-2.1.2/bin/db/datax_web.sql]? (Y/N)y

  41. Please input the db host(default: 127.0.0.1):

  42. Please input the db port(default: 3306):

  43. Please input the db username(default: root):

  44. Please input the db password(default: ): Ghxt@2023

  45. Please input the db name(default: dataxweb)

  46. mysql: [Warning] Using a password on the command line interface can be insecure.

  47. Do you want to confiugre and install [datax-executor]? (Y/N)y

  48. 2023-03-13 15:56:06.729 [INFO] (5272) Install module server: [datax-executor]

  49. 2023-03-13 15:56:06.786 [INFO] (5400) Start to build directory

  50. 2023-03-13 15:56:06.793 [INFO] (5400) Creating directory: [/usr/local/dataxweb/datax-web-2.1.2/modules/datax-executor/bin/../logs].

  51. 2023-03-13 15:56:06.885 [INFO] (5400) Directory or file: [/usr/local/dataxweb/datax-web-2.1.2/modules/datax-executor/bin/../conf] has been exist

  52. 2023-03-13 15:56:06.892 [INFO] (5400) Creating directory: [/usr/local/dataxweb/datax-web-2.1.2/modules/datax-executor/bin/../data].

  53. 2023-03-13 15:56:06.983 [INFO] (5400) Creating directory: [/usr/local/dataxweb/datax-web-2.1.2/modules/datax-executor/bin/../json].

  54. 2023-03-13 15:56:07.074 [INFO] (5272) ####### Finish To Install Modules ######

  55. [root@localhost bin]#

3、查看数据库状态

  1. mysql> use dataxweb

  2. Reading table information for completion of table and column names

  3. You can turn off this feature to get a quicker startup with -A


  4. Database changed

  5. mysql> show tables;

  6. +---------------------+

  7. | Tables_in_dataxweb |

  8. +---------------------+

  9. | job_group |

  10. | job_info |

  11. | job_jdbc_datasource |

  12. | job_lock |

  13. | job_log |

  14. | job_log_report |

  15. | job_logglue |

  16. | job_permission |

  17. | job_project |

  18. | job_registry |

  19. | job_template |

  20. | job_user |

  21. +---------------------+

  22. 12 rows in set (0.00 sec)


  23. mysql>

4、修改DataX Web配置文件

  1. [root@localhost bin]# pwd

  2. /usr/local/dataxweb/datax-web-2.1.2/modules/datax-executor/bin

  3. [root@localhost bin]# vi env.properties

  4. # environment variables


  5. #JAVA_HOME=""


  6. SERVICE_LOG_PATH=${BIN}/../logs

  7. # environment variables


  8. #JAVA_HOME=""


  9. SERVICE_LOG_PATH=${BIN}/../logs

  10. SERVICE_CONF_PATH=${BIN}/../conf

  11. DATA_PATH=${BIN}/../data



  12. ## datax json文件存放位置

  13. JSON_PATH=${BIN}/../json



  14. ## executor_port

  15. EXECUTOR_PORT=9999



  16. ## 保持和datax-admin端口一致

  17. DATAX_ADMIN_PORT=


  18. ## PYTHON脚本执行位置

  19. PYTHON_PATH=/usr/local/datax/bin/datax.py

  20. #PYTHON_PATH=


  21. ## dataxweb 服务端口

  22. SERVER_PORT=9504


  23. #PID_FILE_PATH=${BIN}/service.pid



  24. #debug 远程调试端口

  25. #REMOTE_DEBUG_SWITCH=true

  26. #REMOTE_DEBUG_PORT=7004

  27. "env.properties" 35L, 526C written

5、开启防火墙端口

  1. [root@localhost bin]# firewall-cmd --permanent --zone=public --add-port=9527/tcp --permanent

  2. success

  3. [root@localhost bin]# firewall-cmd --reload

  4. success

  5. [root@localhost bin]# firewall-cmd --permanent --zone=public --add-port=3306/tcp --permanent

  6. success

  7. [root@localhost bin]# firewall-cmd --reload

  8. success

三、最后的成果



欢迎关注公众号:python与大数据分析

文章转载自python与大数据分析,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论