如何使用cqlsh将模式文件加载到Cassandra中

如何使用cqlsh将模式文件加载到Cassandra中

问题描述:

我有一个Cassandra的模式文件。我使用的是Windows 7机器(Cassandra在这个机器以及 - 1个节点)。我想加载与cqssh的模式。到目前为止我还没有找到如何。我希望能够将文件传递给cqlsh: cqlsh mySchemaFile 。但是,由于我在Windows中运行,要启动cqlsh,我做以下

I have a schema file for Cassandra. I'm using a windows 7 machine (Cassandra on this machien as well - 1 node). I want to load the schema with cqssh. So far I have not been able to find how. I was hoping to be able to pass the file to cqlsh: cqlsh mySchemaFile. However since I run in windows, to start cqlsh I do the following

python "C:\Program Files (x86)\DataStax Community\apache-cassandra\bin\cqlsh" localhost 9160

csqsh在我的路径,当调用这样从python它需要完整的路径。

Even though I have csqsh in my path, when called like this from python it needs the full path.

我试图在那里添加文件名,但没有运气到目前为止。
这是可能吗?

I tried to add in there the file name but no luck so far. Is this even possible?

cqlsh通过 - file 选项,而不是位置参数(如主机和端口),因此正确的格式为:

cqlsh takes a file to execute via the -f or --file option, not as a positional argument (like the host and port), so the correct form would be:

python "C:\Program Files (x86)\DataStax Community\apache-cassandra\bin\cqlsh" localhost 9160 -f mySchemaFile

注意:我不能100%确定是否使用 -f \f

Note: I'm not 100% sure about whether you'd use -f or \f in Windows.