Windows11[虚拟机] Kettle 通过SSH隧道 连接远程[Mac] Mysql数据库

news/2024/10/1 9:36:52

Kettle无法直接连接使用SSH通道的MySQL,需要通过SSH隧道(推荐),具体操作如下所示:

一、搭建Xshell SSH 隧道转发

1、点击“连接”

借助Xshell7,首先创建会话mac(名字随便写),右键-->属性,在弹出窗口中填写名称(随便写),填写主机:SSH隧道的ip地

 点击“添加”按钮出现如下,填写源主机:localhost(一般填写localhost), 侦听端口:XXX(端口随便写,但是一定要记住,用于kettle连接数据库) , 目标主机:数据库IP地址(远程主机的IP地址) , 目标端口:3306(mysql开放的端口)

 

点击连接,连接到远程服务器,在Xshell下方的"隧道窗格"中,将看到我们配置的转发规则,如下

 注意看规则的第一行转发配置,确保状态是打开,如果显示的是失败可能是3306这个本地端口已经被占用了,可以尝试将侦听端口修改为其它端口进行重新设置。

二、检查远程服务器MySql文件配置

1、netstat -anp tcp | grep 3306                        

注意地方,这说明3306被绑定到了本地。检查一下my.cnf的配置,这里可以配置绑定ip地址。

cd /usr/local/etc

找到my.cnf文件,修改如下:bind-address=0.0.0.0

不配置或者IP配置为0.0.0.0,表示监听所有客户端连接。

三、开启SSH远程转发功能

SSH默认不允许远程转发

#	$OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.# This Include directive is not part of the default sshd_config shipped with
# OpenSSH. Options set in the included configuration files generally override
# those that follow.  The defaults only apply to options that have not been
# explicitly set.  Options that appear multiple times keep the first value set,
# unless they are a multivalue option such as HostKey.
Include /etc/ssh/sshd_config.d/*#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying
#RekeyLimit default none# Logging
#SyslogFacility AUTH
#LogLevel INFO# Authentication:#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials no# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none# no default banner path
#Banner none# override default of no subsystems
#Subsystem	sftp	/usr/libexec/sftp-server# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server# XAuthLocation added by XQuartz (https://www.xquartz.org)
XAuthLocation /opt/X11/bin/xauth

 

四、在本地测试远程连接

  打开终端

  1、ping 远程ip,如果可以ping通,代表主机可以正常连接。

  2、telnet ip地址 端口号

 以上代表成功。

telnet 主机3306端口不可以;
telnet 主机22端口可以;
说明与本机网络没有关系; 

 

端口检测
1)netstat -ntpl |grep 3306
tcp 0 0 :::3306 :::* LISTEN -
2)netstat -ntpl |grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
可以看出22端口监听所有地址,而3306只监听本机地址(绑定了到了本地),所以远程无法访问。
对于端口只允许本机访问,有两个地方启用,一个是防火墙启用3306,一个就是mysql配置绑定本机地址。

五、kettle使用SSH隧道建立数据库连接

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.ryyt.cn/news/45036.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈,一经查实,立即删除!

相关文章

Linux之JDK安装

JDKjdk 即 Java Development Kit(Java开发工具包),包括了java运行环境,基础类库和一些java工具,是java运行的基础。简单来说 凡是需要java运行的程序都需要安装jdk。下载 官方下载网址 登录并下载安装包安装JDK # pwd /data/apps/ # ll jdk-8u411-linux-x64.tar.gz -rw-r-…

记一次 .NET某机械臂上位系统 卡死分析

一:背景 1. 讲故事 前些天有位朋友找到我,说他们的程序会偶发性的卡死一段时间,然后又好了,让我帮忙看下怎么回事?窗体类的程序解决起来相对来说比较简单,让朋友用procdump自动抓一个卡死时的dump,拿到dump之后,上 windbg 说话。 二:WinDbg 分析 1. 主线程在做什么 要…

什么是SC命令

一、SC命令是XP系统中功能强大的DOS命令,SC命令能与“服务控制器”和已安装设备进行通讯。二、SC.exe提供的功能类似于“控制面板”中“管理工具”项中的“服务” 三、SC命令主要的几个功能: 1. 更改服务的启动状态(这是比较有用的一个功能) ,可以设置存储在注册表中的服务属…

如何基于项目人力和管线方案选择FGUI和UGUI

1)如何基于项目人力和管线方案选择FGUI和UGUI2)TMP字体出包丢失字体描边3)如何将一张贴图经过Shader处理后的结果输出给另外一个Shader使用4)为什么我的水这么干净,和UE教程里的有差别这是第390篇UWA技术知识分享的推送,精选了UWA社区的热门话题,涵盖了UWA问答、社区帖子…

部署搭建帮帮派平台的手册

一、目的 二、过程: 首先有自己的服务器然后会重置一下 然后进入之后上传文件: 创建两个文件夹子: 一个是tools 另一个是helper 解压文件到目录下: 对zip文件来说(防止乱码的问题)unzip -O CP936 基于django的帮帮派在线交易服务平台.zip[root@iZt4n6uqh3zrvvzxfdo3xlZ h…

解决非小程序运行环境,不能调用wx.login()生成code

参考: https://www.cnblogs.com/du-jun/p/12720945.html https://www.cnblogs.com/1zero1/p/13470610.html 1.先调用接口 https://mp.weixin.qq.com/debug/cgi-bin/webdebugger/refreshticket?os=darwin&clientversion=1062402040 生成newticket 2.调用接口 https://serv…

帮帮派在线服务平台项目说明书

一、开发环境 操作系统:windows11 x86 64 编辑器:pycharm 编程语言:python python版本:3.6 mysql版本:5.7.5 二、软件安装为了方便各位大创评委老师评价我们项目,我在另一个文件夹做了一个所需要的软,符合要求的,各位老师下载安装即可。链接:https://pan.baidu.com/s/…

java的封装

高内聚,低耦合:高内聚就是类的内部数据操作细节自己完成,不允许外部干涉;低耦合就是仅暴露少量的方法给外部使用。 封装(数据的隐藏):通常应禁止直接访问一个对象中数据的实际表示,而应通过操作接口来访问。 属性私有,get/set必须使用get或者set方法间接调用 封装的好…