如何更改被控的通讯端口?
被控默认使用的端口是8088,如想更改这个端口,例如我想更改成8888,您可以做如下操作:
防火墙中添加tcp 8888 端口例外
iptables -I INPUT -p tcp -m tcp --dport 8888 -j ACCEPT
service iptables save
编辑被控配置文件,更改httpport=8888,保存
vi /home/nokvm/go/src/conf/app.conf
# 项目名称
appname = NoKvm
# 加载模版渲染(默认false即可)
autorender = false
# 物理机监控间隔时间(推荐1分钟)
node_spec = "@every 1m"
# kvm虚拟机监控间隔时间(推荐一分钟)
kvm_spec = "@every 2m"
copyrequestbody = true
runmode = prod
timezone = 8
# api通讯密码配置文件
include "api.conf"
[prod]
httpport = 8888 #更改端口在这里,在这里,在这里!!!!!!!
db_host = 127.0.0.1
db_port = 3306
db_user = root
db_pass = til1o536
db_name = node
执行重启node服务生效
supervisorctl restart node
更改了被控连接端口以后,如何让主控知道呢? 在主控服务器上编辑配置文件
vi /home/wwwroot/control/.env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:JCQIOT8HSkV2P2wsuXvJmOuXBR+u00trOCojn81Ua2E=
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=control
DB_USERNAME=root
DB_PASSWORD=fdgfhg34..
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
NODE_URL_PORT=8888 #更改端口在这里,在这里,在这里!!!!!!!