Tarantool server on Unix domain socket?

281 views
Skip to first unread message

Frantisek Fuka

unread,
Jun 17, 2015, 5:05:14 AM6/17/15
to tara...@googlegroups.com
Just curious: Is it possible to create Tarantool server on Unix domain socket?

I tried this:


box.cfg{}

local serverfn = function()
print("got!")
end

local socket = require('socket')
print(socket)
socket.tcp_server('localhost', '/tmp/tr.sock', serverfn)

This runs and does not produce any errors but I cannot seem to connect to the socket:

fuxoft@frantisek2:~$ socat - UNIX-CONNECT:/tmp/tr.sock
2015/06/17 11:04:39 socat[26709] E connect(5, AF=1 "/tmp/tr.sock", 14): No such file or directory

Roman Tsisyk

unread,
Jun 17, 2015, 12:43:54 PM6/17/15
to tara...@googlegroups.com


Wednesday, June 17, 2015 2:05 AM -07:00 from Frantisek Fuka <fu...@fuxoft.cz>:


>Just curious: Is it possible to create Tarantool server on Unix domain socket?

Tarantool fully supports UNIX sockets in all modules (socket.tcp_server, socket.tcp_connect, console, net.box, box.cfg { listen = xx }, etc.).

>local socket = require('socket')
>print(socket)
>socket.tcp_server('localhost', '/tmp/tr.sock', serverfn)

try socket.tcp_server('unix/', '/tmp/tr.sock', serverfn). "unix/" is a special value.

--
WBR,
Roman Tsisyk <ro...@tarantool.org>
http://tarantool.org/ - an efficient in-memory data store and a Lua application server

Frantisek Fuka

unread,
Jun 17, 2015, 1:17:56 PM6/17/15
to tara...@googlegroups.com, ro...@tarantool.org
Great, thanks!

Konstantin Osipov

unread,
Jun 17, 2015, 1:27:56 PM6/17/15
to tara...@googlegroups.com
* Frantisek Fuka <fu...@fuxoft.cz> [15/06/17 15:24]:
> Just curious: Is it possible to create Tarantool server on Unix domain
> socket?

>
> I tried this:
>
>
> box.cfg{}
>
> local serverfn = function()
> print("got!")
> end
>
> local socket = require('socket')
> print(socket)
> socket.tcp_server('localhost', '/tmp/tr.sock', serverfn)

Try using 'unix/' for host name:

https://github.com/tarantool/tarantool/blob/master/src/lua/bsdsocket.lua#L986

--
http://tarantool.org - a NoSQL database in a Lua script
Reply all
Reply to author
Forward
0 new messages