数据库密码工具
运行 sdbpasswd 命令的用户必须对准备写入密码的加密文件具有读写权限,加密文件的权限设置为 600。
sdbpasswd 不需要与数据库连接。
- 增加用户 sdbadmin,并指定密码为 sdbadmin
- 增加用户 sdbadmin,并使用命令行提示的方式输入密码
- $ sdbpasswd --adduser sdbadmin --password
- password:
- 增加用户 sdbadmin,且通过 @ 符区分从属于不同集群的用户
- $ sdbpasswd --adduser sdbadmin@db1 --password 123456
- 增加用户 sdbadmin,指定密码为 sdbadmin,并指定加密口令为 sequoiadb
- $ sdbpasswd --adduser sdbadmin --password sdbadmin --token sequoiadb
- 增加用户 sdbadmin,指定密码为 sdbadmin,并指定加密文件位置
- 删除用户 sdbadmin@db1
- $ sdbpasswd --removeuser sdbadmin@db1
通过 sdbpasswd 增加密码后就可以在各个数据库工具使用加密文件的方式输入密码了。
下列工具都是通过指定用户名,再加上打开 cipher 开关来指定使用加密文件,指定的用户名对应通过 sdbpasswd 增加的用户名,对于参数的详细介绍请访问各工具的介绍页面:
工具名 | 使用加密文件的参数组合 |
---|---|
sdbexprt | —user sdbadmin —cipher true —token sequoiadb —cipherfile ./passwd |
sdbimprt | —user sdbadmin —cipher true —token sequoiadb —cipherfile ./passwd |
sdbreplay | —user sdbadmin —cipher true —token sequoiadb —cipherfile ./passwd |
sdbtop | —usrname sdbadmin —cipher true —token sequoiadb —cipherfile ./passwd |
sdblobtool | —usrname sdbadmin —cipher true —token sequoiadb —cipherfile ./passwd |
sdbinspect | —auth sdbadmin —cipher true —token sequoiadb —cipherfile ./passwd |
Sequoiasql-pgsql | user 'sdbadmin', cipher 'on', token 'sequoiadb', cipherfile '/opt/sequoiadb/passwd' |
sdbexprt:
- $ sdbexprt -s localhost -p 11810 --type csv --file foo.bar.csv --fields field1,fieldNotExist,field3 -c foo -l bar --user sdbadmin --cipher true --token sequoiadb --cipherfile ./passwd
sdbimprt:
- $ sdbimprt -s localhost -p 11810 -c foo -l bar --file foo.bar.csv --type csv --headerline true --fields='c int,d string' --user sdbadmin --cipher true --token sequoiadb --cipherfile ./passwd
sdbreplay:
sdbtop:
- $ sdbtop -i localhost -s 11810 --usrname sdbadmin --cipher true --token sequoiadb --cipherfile ./passwd
sdblobtool:
- $ sdblobtool --operation export --hostname localhost --svcname 50000 --collection foo.bar --file /opt/mylob --usrname sdbadmin --cipher true --token sequoiadb --cipherfile ./passwd