我使用freebsd 10并尝试设置tarantool 1.6。使用pkg安装并创建默认示例实例:
cp /usr/local/etc/tarantool/instances.enabled/example.lua /usr/local/etc/tarantool/instances.enabled/example.lua
现在它通过rc.d成功启动,但它只是在监听ipv6:
# ps axu | grep tar
tarantool 32878 0.0 1.2 1086608 9004 - Is 1:40PM 0:00.05 tarantool example.lua <running> (tarantool)
# sockstat -l | grep tar
tarantool tarantool 32878 10 tcp6 *:3301 *:*
tarantool tarantool 32878 16 stream /var/run/tarantool/example.control
它有点奇怪它只听ipv6 *:3301
。我看不到在实例配置文件中设置listen ip或protocol的选项:
# grep -i -e listen -e port -e host /usr/local/etc/tarantool/instances.enabled/example.lua
-- The read/write data port number or URI
listen = 3301;
-- { uri = [[host1.com:4301]]; zone = [[0]]; };
-- { uri = [[host2.com:4302]]; zone = [[1]]; };
这就是我在ifconfig
中所拥有的:
# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=503<RXCSUM,TXCSUM,TSO4,LRO>
ether 00:16:3e:9b:b0:8b
inet x.x.x.x. netmask 0xffffff00 broadcast x.x.x.x
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet manual
status: active
所以问题是:如何设置IPv4侦听以及如何限制要侦听的地址列表?
答案 0 :(得分:1)
在其中使用带有主机名的URI字符串,例如,listen =&#34; localhost:3301&#34;。如果有多个接口匹配uri Tarantool绑定到解析器返回的第一个接口。