2

Edited: I'm quite new to all this admin stuff though! So: Whats the best way to connect a port on server A to the database on server B.

The reason i want to do this: I want to connect server A to a cassandra database on server B. I read that this could work over ssh tunnel... but is this really the best option between the two servers only?

Could someone give an example maybe?

Jurudocs
  • 339
  • 1
  • 3
  • 11
  • 1
    I'm not completely understanding your question. You want to connect to a database on Server B from server A? What's forwarding got to do with it? – joeqwerty Dec 16 '15 at 19:25
  • Oh okay let me try to explain a bit more. I just want to make sure that server A can connect to B's database... has nothing to do with me debugging. so How do you manage to conntect server A to the database of server B? Should server A ssh into server b? – Jurudocs Dec 16 '15 at 20:20

1 Answers1

1

You'll want to ssh from server A with the following:

ssh user@serverB -L xxxx:127.0.0.1:yyyy

As long as you leave that tunnel open, you can connect to port xxxx on server A and your connection will be forwarded to port yyyy on server B.

As for whether or not this is the best option, that depends. Best option for remotely administering/debugging the database? Possibly. It's secure (as long as ssh access is secure). Is it the best for long term connections in production? Probably not. I'd suggest ACLs only allowing access to the database on server B from server A.

See the following Security StackExchange question for more details: https://security.stackexchange.com/questions/8861/what-is-the-best-practice-for-placing-database-servers-in-secure-network-topolog

Carrot
  • 266
  • 3
  • 8