38 lines
735 B
Plaintext
38 lines
735 B
Plaintext
# 运维机器创建隧道代理
|
||
# 前台运行无日志 -v打印二进制信息:
|
||
socat TCP-LISTEN:27017,reuseaddr,fork TCP:170.106.187.49:27017
|
||
|
||
|
||
|
||
# systemd管理:
|
||
vim /etc/systemd/system/socat-mongo.service
|
||
|
||
[Unit]
|
||
Description=Socat MongoDB Proxy
|
||
After=network-online.target
|
||
Wants=network-online.target
|
||
|
||
[Service]
|
||
Type=simple
|
||
ExecStart=/usr/bin/socat TCP-LISTEN:27017,reuseaddr,fork TCP:170.106.187.49:27017
|
||
Restart=always
|
||
RestartSec=2
|
||
LimitNOFILE=65535
|
||
StandardOutput=syslog
|
||
StandardError=syslog
|
||
SyslogIdentifier=socat-mongo
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
|
||
|
||
# 启用服务
|
||
systemctl daemon-reload
|
||
systemctl start socat-mongo
|
||
systemctl stop socat-mongo
|
||
systemctl status socat-mongo
|
||
systemctl enable socat-mongo
|
||
|
||
# 日志
|
||
|