Command line

machbase-neo serve

Start machbase-neo server process.

Flags

flagdesc
--hostlistening network addr (default 127.0.0.1)
ex) --host 0.0.0.0
-c, --configconfig file location
ex) --config /data/machbase-neo.conf
--pidfile path to save pid
ex) --pid /data/machbase-neo.pid
--datapath to database (default ./machbase_home)
ex) --data /data/machbase
--filepath to files (default .)
ex) --file /data/files
--log-filenamelog file path (default - stdout)
ex) --log-filename /data/logs/machbase-neo.log
--log-levellog level. TRACE, DEBUG, INFO, WARN, ERROR (default INFO)
ex) --log-level INFO
--log-appendappend existing log file. (default true) Since v8.0.13
--log-rotate-scheduletime scheduled log file rotation (default @midnight) Since v8.0.13
--log-max-sizefile max size in MB (default 10) Since v8.0.13
--log-max-backupsmaximum log file backups (default 1) Since v8.0.13
--log-max-agemaximum days in backup files (default 7) Since v8.0.13
--log-compressgzip compress the backup files (default false) Since v8.0.13
--log-time-utcuse UTC time for logging (default false) Since v8.0.13
--presetdatabase preset auto, fog, edge (default auto)
ex) --preset edge
πŸ“Œ
IMPORTANT
Since the default of --host is the loopback address, it is not allowed to access machbase-neo from the remote hosts.
Set --host <host-address> or --host 0.0.0.0 for accepting the network connections from remote clients.

If execute machbase-neo serve with no flags,

$ machbase-neo serve

it is equivalent with

$ machbase-neo serve --host 127.0.0.1 --data ./machbase_home --file . --preset auto

machbase-neo shell

Start machbase-neo shell. It will start interactive mode shell if there are no other arguments.

Flags

flag (long)desc
-s, --servermachbase-neo’s gRPC address.
default: --server tcp://127.0.0.1:5655
e.g. -s unix://./mach-grpc.sock
--useruser name.
default: sys
env: NEOSHELL_USER
Since v8.0.4
--passwordpassword.
default: manager
env: NEOSHELL_PASSWORD
Since v8.0.4

When machbase-neo shell starts, it is looking for the user name and password from OS’s environment variables NEOSHELL_USER and NEOSHELL_PASSWORD. Then if the flags --user and --password are provided, it will override the provided values instead of the environment variables.

Precedence of username and password

Command line flags

If --user, --password is provided? Use the given values

Environment variables

If $NEOSHELL_USER (on windows %NEOSHELL_USER%) is set? Use the value as the user name.

If $NEOSHELL_PASSWORD (on windows %NEOSHELL_PASSWORD%) is set? Use the value as the password.

Default

None of those are provided? Use default value sys and manager.

Practical usage

For the security, use instant environment variables as below example.

$ NEOSHELL_PASSWORD='my-secret' machbase-neo shell --user sys

Be aware when you use --password flag, the secret can be exposed by simple ps command as like an example below.

$ machbase-neo shell --user sys --password manager
$ ps -aef |grep machbase-neo
  501 13551  3598   0  9:33AM ttys000    0:00.07 machbase-neo shell --user sys --password manager

Run Query

machbase-neoΒ» select binary_signature from v$version;
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ROWNUM β”‚ BINARY_SIGNATURE                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      1 β”‚ 8.0.2.develop-LINUX-X86-64-release-standard β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
a row fetched.

Create Table

machbase-neoΒ» create tag table if not exists example (name varchar(20) primary key, time datetime basetime, value double summarized);
executed.

Schema Table

machbase-neoΒ» desc example;
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ROWNUM β”‚ NAME  β”‚ TYPE     β”‚ LENGTH β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      1 β”‚ NAME  β”‚ varchar  β”‚     20 β”‚
β”‚      2 β”‚ TIME  β”‚ datetime β”‚      8 β”‚
β”‚      3 β”‚ VALUE β”‚ double   β”‚      8 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Insert Table

machbase-neoΒ» insert into example values('tag0', to_date('2021-08-12'), 100);
a row inserted.

Select Table

machbase-neoΒ» select * from example;
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ROWNUM β”‚ NAME β”‚ TIME(LOCAL)         β”‚ VALUE β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚      1 β”‚ tag0 β”‚ 2021-08-12 00:00:00 β”‚ 100   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
a row fetched.

Drop Table

machbase-neoΒ» drop table example;
executed.

Show

Display information.

show [options] <object>
        objects:
          info                   show server info
          license                show license info
          ports                  show service ports
          users                  list users
          tables [-a]            list tables
          table [-a] <table>     describe the table
          meta-tables            list meta tables
...
        options:
          -a,--all               includes all hidden tables/columns

show info

machbase-neoΒ» show info;
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ NAME               β”‚ VALUE                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ build.version      β”‚ v2.0.0                      β”‚
β”‚ build.hash         β”‚ #c953293f                   β”‚
β”‚ build.timestamp    β”‚ 2023-08-29T08:08:00         β”‚
β”‚ build.engine       β”‚ static_standard_linux_amd64 β”‚
β”‚ runtime.os         β”‚ linux                       β”‚
β”‚ runtime.arch       β”‚ amd64                       β”‚
β”‚ runtime.pid        β”‚ 57814                       β”‚
β”‚ runtime.uptime     β”‚ 2h 30m 57s                  β”‚
β”‚ runtime.goroutines β”‚ 45                          β”‚
β”‚ mem.sys            β”‚ 32.6 MB                     β”‚
β”‚ mem.heap.sys       β”‚ 19.0 MB                     β”‚
β”‚ mem.heap.alloc     β”‚ 9.7 MB                      β”‚
β”‚ mem.heap.in-use    β”‚ 13.0 MB                     β”‚
β”‚ mem.stack.sys      β”‚ 1,024.0 KB                  β”‚
β”‚ mem.stack.in-use   β”‚ 1,024.0 KB                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Desc

Describe table structure.

machbase-neoΒ» desc example;
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ROWNUM β”‚ NAME  β”‚ TYPE     β”‚ LENGTH β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      1 β”‚ NAME  β”‚ varchar  β”‚     20 β”‚
β”‚      2 β”‚ TIME  β”‚ datetime β”‚      8 β”‚
β”‚      3 β”‚ VALUE β”‚ double   β”‚      8 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

machbase-neo version

Show version and engine info.

machbase-neo_version

machbase-neo gen-config

Prints out default config template.

$ machbase-neo gen-config ↡

define DEF {
    LISTEN_HOST       = flag("--host", "127.0.0.1")
    SHELL_PORT        = flag("--shell-port", "5652")
    MQTT_PORT         = flag("--mqtt-port", "5653")
    HTTP_PORT         = flag("--http-port", "5654")
    GRPC_PORT         = flag("--grpc-port", "5655")
......
Last updated on