分离部署Cannot assign requested address

sunyzy

进行分离部署的时候gateway服务器启动正常

----------------------- WORKERMAN -----------------------------
Workerman version:3.2.3          PHP version:5.3.3
------------------------ WORKERS -------------------------------
user          worker        listen                    processes status
root          ChatGateway   Websocket://0.0.0.0:7272   4          
root          Register      text://10.44.26.224:1236   1          
root          WebServer    0.0.0.0:55151       2          
----------------------------------------------------------------

BusinesWorker启动出现问题

PHP Warning:  stream_socket_server(): unable to connect to tcp://10.44.26.224:1236 (Cannot assign requested address) in /root/workerman-server/Workerman/Worker.php on line 1288
7168 7 1
7个回答

walkor 打赏

参见手册 常见问题 之 启动失败
http://doc3.workerman.net/faq/workerman-start-fail.html

Cannot assign requested address一般是由于监听ip填写的不是本机ip导致。
服务器上运行ip addr看下 10.44.26.224是否属于当前服务器

  • 暂无评论
sunyzy

还是不行。两台机器都是centos6.5 全新系统,只安装了php相关。
gateway服务器:

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:00:7f:28 brd ff:ff:ff:ff:ff:ff
    inet 10.44.26.224/21 brd 10.44.31.255 scope global eth0
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

gateway服务器启动脚本

$gateway = new Gateway("Websocket://0.0.0.0:7272");
$gateway->name = 'ChatGateway';
$gateway->count = 4;
$gateway->lanIp = '0.0.0.0'; //设置成10.44.26.224也不行
$gateway->startPort = 2300;
$gateway->pingInterval = 10;
$gateway->pingData = base64_encode('{"type":"ping"}');
$gateway->registerAddress = '10.44.26.224:1236';

gateway服务器 start_register启动脚本
$register = new Register('text://10.44.26.224:1236'); //设置成0.0.0.0也不行

bussinessWorker 服务器启动脚本

$worker = new BusinessWorker();
$worker->name = 'ChatBusinessWorker';
$worker->count = 4;
$worker->registerAddress = '10.44.26.224:1236';

bussinessWorker 服务器 start_register启动脚本

$register = new Register('text://10.44.26.224:1236'); 

在bussinessWorker 服务器 使用telnet命令可以连接,gateway服务器有timeout和unknown event提示

谢谢!

  • 暂无评论
walkor 打赏

lanIp 不能填写0.0.0.0

  • 暂无评论
sunyzy

lanIp 写本地IP也不行
对系统环境有什么要求吗

  • 暂无评论
sunyzy

我用的阿里云的服务器

  • 暂无评论
walkor 打赏

还不行可以给我下临时账户,我上去给你看下

  • 暂无评论
walkor 打赏

gateway服务器 start_register启动脚本
$register = new Register('text://10.44.26.224:1236'); //设置成0.0.0.0也不行

bussinessWorker 服务器 start_register启动脚本
$register = new Register('text://10.44.26.224:1236');

阿里云里面两台台服务器监听同一个ip肯定不对啊,ip只属于其中一台服务器,
监听的ip不是本机ip就会报Cannot assign requested address错误

  • 暂无评论
年代过于久远,无法发表回答
×
🔝