Remote access with SSH
machbase-neo supports ssh interface for the remote operation and administration. Users can access the sql interpreter via ssh command like below.
Connect from a remote host
- User: SYS
- Default password: manager
$ ssh -p 5652 sys@127.0.0.1
sys@127.0.0.1's password: manager↵
Then after machbase-neo»
prompt, users can query with SQL statements.
machbase-neo» select * from example;
┌─────────┬──────────┬─────────────────────────┬───────────┐
│ ROWNUM │ NAME │ TIME(UTC) │ VALUE │
├─────────┼──────────┼─────────────────────────┼───────────┤
│ 1 │ wave.sin │ 2023-01-31 03:58:02.751 │ 0.913716 │
│ 2 │ wave.cos │ 2023-01-31 03:58:02.751 │ 0.406354 │
...omit...
│ 13 │ wave.sin │ 2023-01-31 03:58:05.751 │ 0.668819 │
│ 14 │ wave.cos │ 2023-01-31 03:58:05.751 │ -0.743425 │
└─────────┴──────────┴─────────────────────────┴───────────┘
Use public key authentication with SSH
Adding the public key to machbase-neo server makes it possible to execute any machbase-neo shell
command without prompt and entering password.
Add your public key to server
machbase-neo shell ssh-key add `cat ~/.ssh/id_rsa.pub`
Get list of registered public keys
machbase-neo shell ssh-key list
or
$ machbase-neo shell ↵
machbase-neo» ssh-key list
┌────────┬────────────────────────────┬─────────────────────┬──────────────────────────────────┐
│ ROWNUM │ NAME │ KEY TYPE │ FINGERPRINT │
├────────┼────────────────────────────┼─────────────────────┼──────────────────────────────────┤
│ 1 │ myid@laptop.local │ ssh-rsa │ 80bdaba07591276d065ca915a6037fde │
│ 2 │ myid@desktop.local │ ecdsa-sha2-nistp256 │ e300ee460b890ad4c22cd4c1eae03477 │
└────────┴────────────────────────────┴─────────────────────┴──────────────────────────────────┘
Remove registered public key
machbase-neo» ssh-key del <fingerprint>
Execute commands via SSH
We can execute any machbase-neo shell command remotely only with ssh
.
$ ssh -p 5652 sys@127.0.0.1 'select * from example order by time desc limit 5'↵
ROWNUM NAME TIME(UTC) VALUE
──────────────────────────────────────────────────
1 wave.sin 2023-02-09 11:46:46 0.406479
2 wave.cos 2023-02-09 11:46:46 0.913660
3 wave.sin 2023-02-09 11:46:45 -0.000281
4 wave.cos 2023-02-09 11:46:45 1.000000
5 wave.cos 2023-02-09 11:46:44 0.913431
Last updated on