【问题标题】:How can we set nodetool and cqlsh to be run from anywhere and by any user on linux server我们如何将 nodetool 和 cqlsh 设置为在 linux 服务器上由任何用户在任何地方运行
【发布时间】:2017-02-15 00:18:58
【问题描述】:
我正在尝试设置环境变量,以便特定服务器上的任何用户都可以从 linux 文件系统中的任何位置运行 nodetool 或 cqlsh 等命令。应该节省每次遍历bin目录的工作量。
我们怎样才能做到这一点?我的 DSE 4.8 是一个 tarball 安装。
【问题讨论】:
标签:
cassandra
cql
cassandra-2.0
datastax-enterprise
nodetool
【解决方案1】:
- Nodetool 通常可供任何在您的 linux 机器中具有执行权限的用户使用
- 对于 cqlsh,您可以在 cqlshrc 文件中设置任何配置(通常在 $HOME/.cassandra/cqlshrc 中找到;我们曾经启用客户端节点加密,但有更多可配置选项
【解决方案2】:
要设置环境变量,只需按照 root 用户的一些步骤操作:
# vi /etc/profile.d/cassandra.sh
将以下行添加到cassandra.sh 文件中-
export CASSANDRA_HOME=/opt/apache-cassandra-3.0.8
export CASSANDRA_CONF_DIR=/opt/apache-cassandra-3.0.8/conf
这里/opt/ 是我的目录,我在其中提取了我的apache-cassandra-3.0.8-bin.tar.gz 压缩包。
将这些行添加到cassandra.sh 后,保存并退出。然后-
# source /etc/profile.d/cassandra.sh