Files
Work-configuration-file/MongoDB/相关命令.conf
2025-10-07 15:58:15 +08:00

38 lines
735 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 运维机器创建隧道代理
# 前台运行无日志 -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
# 日志