Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to connect through admin (control) socket #193

Open
kluevandrew opened this issue Jul 8, 2022 · 9 comments
Open

Add ability to connect through admin (control) socket #193

kluevandrew opened this issue Jul 8, 2022 · 9 comments
Labels
wontfix This will not be worked on

Comments

@kluevandrew
Copy link

At the moment connector allow to connect through tcp and unix socket, but sometimes it's can be useful to connect through “admin port”.

Expect behavior is like in tarantoolctl.

Step to reproduce:

  1. Create init.lua
local console = require('console')

box.cfg{
    listen = 'unix/:./tnt.sock'
}
box.schema.user.grant('guest','super')

console.listen('unix/:./tnt.control')
  1. Start tarantool
tarantool init.lua
  1. Try to connect via tarantoolctl through unix socket (it should works)
tarantoolctl connect unix/:./tnt.sock 
  1. Try to connect via tarantoolctl through admin socket (it should works too)
tarantoolctl connect unix/:./tnt.control 
  1. Now create main.go and try the same connections from go
// main.go
package main

import (
	"fmt"
	"github.com/tarantool/go-tarantool"
	"log"
)

func main() {
	opts := tarantool.Opts{}

	connUnixSocket, err := tarantool.Connect("unix/:./tnt.sock", opts)
	if err != nil {
		log.Fatalf("Unix socket not connected: %s", err)
	}
	fmt.Printf("Version from unix socket is %s", connUnixSocket.Greeting.Version)

	connControlSocket, err := tarantool.Connect("unix/:./tnt.control", opts)
	if err != nil {
		log.Fatalf("Control socket not connected: %s\n", err)
	}
	fmt.Printf("Version from control socket is %s", connControlSocket.Greeting.Version)
}
  1. Try to execute it
go run main.go

Actual result:

Version from unix socket is Tarantool 2.10.0 (Binary) bee3cc79-e645-4cea-ad1b-b4aed844f4ba 
2022/07/08 12:13:29 Control socket not connected: Wrong reponse header
exit status 1

Expected result:

Version from unix socket is Tarantool 2.10.0 (Binary) bee3cc79-e645-4cea-ad1b-b4aed844f4ba 
Version from control socket is Tarantool 2.10.0 (Binary) bee3cc79-e645-4cea-ad1b-b4aed844f4ba 
@Totktonada
Copy link
Member

Is there an example implementation in another connector?

@kluevandrew
Copy link
Author

Is there an example implementation in another connector?

At least in tarantoolctl

https://github.com/tarantool/tarantool/blob/master/extra/dist/tarantoolctl.in

@kluevandrew
Copy link
Author

New CLI "TT" is written in go and works with it https://github.com/tarantool/tt/tree/master/cli/connector

@R-omk
Copy link

R-omk commented Jul 8, 2022

@NeraverinTarantool
Copy link

Is there an example implementation in another connector?

@Totktonada you can check https://github.com/igorcoding/asynctnt/blob/master/tests/test_connect.py#L83

@Totktonada
Copy link
Member

@NeraverinTarantool It is usual for connectors to have a test helper to work with a console to don't prepare data for testing with tested functions. IOW, to don't test the binary protocol implementation using this implementation itself.

I meant implementation in a connector's public API, not internally for testing purposes.

@kluevandrew
Copy link
Author

Any news on it?

@LeonidVas LeonidVas removed the teamE label Oct 4, 2022
@Mons
Copy link

Mons commented Feb 21, 2023

We have no plans to implement and support in.
But nevertheless it may be done by community

@oleg-jukovec oleg-jukovec added the wontfix This will not be worked on label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

9 participants