ssh转发
ali-confluent-2
/user/hive/warehouse
/user/hive/warehouse/db_test1.db
yum install expect -y
cd /root
cd /root/.ssh/
vim config
Host oride-ops
HostName 152.32.140.150
Port 22
User root
IdentityFile ~/.ssh/uc2
vim uc2
私钥
mkdir .nat_rules/oride -p
vim oride-ops-mysql-13311
#!/bin/bash
L_PORT="13311"
R_HOST="10.52.80.112"
R_PRI_PORT="13305"
MON_PORT="0"
ALIAS="oride-ops"
VAR=$(expect -c "
spawn /usr/bin/autossh -M $MON_PORT -4 -C -L 0.0.0.0:$L_PORT:$R_HOST:$R_PRI_PORT -N $ALIAS
match_max 100000
expect \"$?assphrase*\"
send -- \"$PASS\r\"
send -- \"\r\"
expect eof
")
echo "======================="
echo "$VAR"
~
有些人,自甘堕落;有些人,即便身处深渊,也依旧笑容灿烂。