Create RethinkDB database from command line - rethinkdb

I need to programatically create a RethinkDB database from the command line. However...I have no clue how to do this.
I know that I can do this from the web UI or from a client driver, but isn't there a command that does this?

As mlucy mentioned, you can create databases and tables using the query language. If you'd like to run RethinkDB queries directly from the command line, you may want to try one of these libraries:
reql-cli: https://github.com/Workshape/reql-cli
recli: https://github.com/stiang/recli

If you have the Python driver you can do the following:
echo -e 'import rethinkdb as r; \nr.connect("localhost", 28015).repl() \nr.db_create("NAME_OF_YOUR_DATABASE").run()' | python
To install the Python driver, you can just use pip:
pip install rethinkdb
This might not be the best way of doing this, but it might be the easiest way of achieving this if you want to create a database in one line from the command line.
If you a Node.js developer, I would recommend using the two CLIS mglukhovsky mentioned.

As of RethinkDB 2.0 I believe you can only do this with the web UI or a client driver. Is there a reason why shelling out to Python or Ruby doesn't work here?

Related

Lolcode: variable does not exist: STDIO

I got the following problem while trying to run a LOLCODE program:
variable does not exist: STDIO
I think it's something with me running on Windows instead of any linux. I want to use LOLCODE for a school assignment, as in my opinion just using Python would be too easy.
Thank you,
I was also having this issue while trying to use STDIO for file I/O.
Turns out you must use the future branch of lci for that functionality.
Simply do,
git clone -b future https://github.com/justinmeza/lci.git.
then,
If on linux use python3 install.py.
For windows follow the official guide.

Unable to start Cassandra server on unix machine

I am newbie to cassandra and needed help with starting cassandra server on Unix machine. I have a cassandra installation and while executing ./bin/cassandra -f I am getting the following error -
./bin/cassandra: test: unknown operator >
Another error is while executing cqlsh in the same directory.
cqlsh: syntax error at line 21: `print' unexpected
I have jdk 1.8 and python 2.4.4 in my environment. Also I tried using tcsh and bash both.
Kindly provide suggestions and appreciate for solutions.
Changing the TCSH to Bash and editing the cassandra scripts solved it.
The best reference for working on solaris -https://blogs.oracle.com/partnertech/entry/how_to_build_and_run
There are definitely some tricks to getting Cassandra to run on certain brands of UNIX. It would also help to know which version of Cassandra you are trying to run.
First of all, you should definitely run it from Bash.
./bin/cassandra: test: unknown operator >
Next, this is happening because conf/cassandra-env.sh is trying to check your Java version. Depending on which version of Cassandra you have, it's trying to do something like this:
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ]
In Bash on Linux that works fine. But for some brands of UNIX that operator may not work the same way. Honestly, as long as you know your version of Java is good, you should be able to edit conf/cassandra-env.sh and comment-out those checks.
cqlsh: syntax error at line 21: `print' unexpected
This error is happening because of this line:
python -c 'import sys; sys.exit(not (0x020700b0 < sys.hexversion < 0x03000000))' 2>/dev/null \
&& exec python "`python -c "import os;print(os.path.dirname(os.path.realpath('$0')))"`/cqlsh.py" "$#"
It is probably due to the fact that the cqlsh wrapper script is failing to find an appropriate version of Python on your machine. I'm not aware of cqlsh being able to work with Python 2.4, so I'd try upgrading that to 2.7.
In short though, you'll have much better chances for success if you can get a flavor of Linux to run Cassandra on. Even if you get around these errors, my bet is that you'll get hit with a few more, so it'll probably be easier just to change to Linux now.

plutil: command not found

Ultimate Goal:
I'm trying to convert a binary plist file to an xml format so that I can put it in an array and grab values from it. What I'm finding via web search on this is that the command for Linux comes from libplist.
Problem: I ran "yum install libplist" and it told me libplist is already installed and latest version. I've read that if I enter the following command:
plutil -i /mypath/file.plist > /mypath/file.xml.plist
That this will help accomplish my ultimate goal. However, when I do this only a blank file called file.xml.plist is created. Further, with this command and any other command involving plutil, I get a "bash: plutil: command not found. . ." error. Is libplist seemingly not installed (even though it says it is) or why would I repeatedly get this error? Thanks for your help.
You can use yum to look for a package knowing the binary you want. For instance, if I want to install the package that provides plutil, I simply run this command:
$> yum provides plutil
Unfortunately, the result is No matches found... But you say you read that the libplist package provides this tool. Maybe it was renamed ? Let's use repoquery for this (if you don't have it, yum provides repoquery tells you that you need to install yum-utils).
$> repoquery --list libplist
/usr/bin/plistutil
/usr/lib/libplist++.so.3
/usr/lib/libplist++.so.3.0.0
/usr/lib/libplist.so.3
/usr/lib/libplist.so.3.0.0
/usr/share/doc/libplist
/usr/share/doc/libplist/AUTHORS
/usr/share/doc/libplist/COPYING.LESSER
/usr/share/doc/libplist/README
And what I see is that a program called plistutil was installed with this package !
I've never used plutil, so I can't tell you for sure plistutil is the program you want (but it probably is). What I wanted to do instead with this post is to show how you can use yum to install the packages you need !
I ran across this thread while Googling for the same thing myself. After looking at a few solutions for my own company (Screenplay) I decided to fork and iterate on a open-source, cross-platform, drop-in replacement for plutil:
https://github.com/screenplaydev/plutil
It's forked from Facebook's xcbuild (a tool developed by them to build xcode projects on Linux), but stripped down to just provide plist-editting functionality. That way you won't need to maintain separate code-paths for Mac and Linux environments.
Hope that's helpful!

Use perlcassa in Window

I'm trying to use perlcassa perl package in Window app. I started make but it failed because of missing prerequisites like Thrift::XS and Tie::IxHash
Unfortunatelly such prerequisites are not available for Windows.
Any idea how to overcome this?
Or is there another Perl package for Cassandra that supports Windows?
Thanks,
Abed.
Using Cassandra command line solves the problem. It is easy, direct and no need for additional packages. i.e I wrote Cassadnra script and used -f option in Cassandra CLI to invoke it.

Problem with Zend Framework Quickstart Tutorial and version 1.8.2

I'm trying to work through the quick start tutorial of the Zend Framework version 1.8.2, but I'm getting an error when running this code:
zf.sh create project quickstart
error: expecting `'{'' in /Users/andrew/Sites/_library/ZendFramework-1.8.2/library/Zend/Tool/Framework/Client/Console.php on line 63
I'm doing this on Mac OS X 10.4. Is there an error in Zend Tool? or am I doing something wrong? Or is my environment not set up correctly to run this script?
I tried this on my other computer and got
-bash: zf.sh: command not found
I think this one is a separate problem, but not sure what to do
to the second problem:
$ chmod +x zf.sh
or place it to /usr/bin (or where the other executables lives, don't know where it is in OS X)
or use
$ sh ./zf.sh
first problem:
which PHP version do you use? The problem exists maybe at multi interface implementation.
you can still manually create the folder structure that Zend_Tool does, the quickstart guide does give examples of the naming conventions and there are numerous other examples. in order to better understand the framework, doing this manually can be good since your forced to think about the files your creating and how they are used.

Resources