如何从任何地方运行Cassandra(cqlsh) [英] How to run Cassandra (cqlsh) from anywhere

查看:84
本文介绍了如何从任何地方运行Cassandra(cqlsh)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Cassandra中,官方文档( https://wiki.apache.org/cassandra/GettingStarted)指出,要开始使用服务,请使用

In Cassandra the official documentation (https://wiki.apache.org/cassandra/GettingStarted) it states, to start the service use

'bin/cassandra -f'

然后使用

'bin/cqlsh'

访问。但是要以这种方式使用cqlsh,我总是必须转到bin文件夹。使它能够正常运行的过程是什么,以便可以从控制台的任何位置键入 cqlsh进行访问(不必位于Cassandra安装程序的bin文件夹中)?

to access. But to use cqlsh in this way I always have to go to the bin folder. What is the procedure to make it work such that I can type 'cqlsh' from anywhere in the console to access (not have to be in the bin folder of Cassandra setup) ?

(就像我们通过在控制台中键入python3直接从任何地方直接访问python一样)

(just like we access python directly from anywhere by just typing python3 in console )

推荐答案

要使这项工作正常进行,您必须将您的Cassandra bin 目录添加到您的 $ PATH

To get this work work, you have to add your Cassandra bin directory to your $PATH.

在终端提示符下,检查 $ PATH 的内容。

From a terminal prompt, check the contents of your $PATH.

$ echo $PATH

在我的Ubuntu VM上,这是我看到的:

On my Ubuntu VM, this is what I see:

/usr/local/apache-maven/apache-maven-3.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.7.0_45/bin

由于您提到了Python3,因此我还将检查它在系统中的位置:

Since you mention Python3, I'll check the location of that on my system as well:

$ which python3
/usr/bin/python3

您可以看到,Python3在我的 / usr / bin 目录中,而 / usr / bin 在我的 $ PATH 中,这就是为什么只需键入 python3 对我有用(对您也一样)。

As you can see, Python3 is in my /usr/bin directory, and /usr/bin is in my $PATH, which is why simply typing python3 works for me (and you as well).

有几种方法可以让Cassandra bin 目录放入 $ PATH 。关于哪种是完成此任务的正确方法存在一些争论。因此,代替告诉您 I 的工作方式,我将提供指向 AskUbuntu 上一个问题的链接,该链接详细说明了类似于3种将目录添加到您的 $ PATH 的方法:如何在目录中添加目录?

There are a few ways to get your Cassandra bin directory into your $PATH. There is some debate about which is the "correct" way to do accomplish this. So in lieu of telling you how I would do it, I will provide a link to a question on AskUbuntu that details something like 3 ways to add a directory into your $PATH: How to add a directory to my path?

这篇关于如何从任何地方运行Cassandra(cqlsh)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆