Running a query

Now that we have a RethinkDB installation up and running, let's give it a quick try to make sure that everything is set up correctly. There are a few things that you might want to try to ensure that your database is running correctly. The first step is to try and access the web interface by browsing http://127.0.0.1:8080.

Tip

To access RethinkDB's web administration interface, you have to substitute 127.0.0.1 with the public IP that your instance is bound to.

If everything is working correctly, you'll see the RethinkDB web interface:

Running a query

The web interface allows you to view the status of your cluster and manage each server independently. In the main view, we can see some standard health checks and cluster performance metrics, whereas at the bottom, we can find the most recently logged activities.

If we click on the Tables link at the top of the page, we can see all the tables that we have added to our database:

Running a query

From this page, we can see all the databases that we have in the cluster. Within each database, we can see all the tables that we have created. As you can see from this screenshot, the cluster currently contains one database called test but no tables.

The web interface also provides a Data Explorer page that we can use to learn the query language and execute queries. If we click on the Data Explorer link, we are given an interface that allows us to interact with the server using the query language.

You now have an interactive shell at which you can issue commands. So, let's run our first query! Insert the following query into the Data Explorer:

r.db('test').tableCreate('people')

This simple query creates a table called people inside the test database. If you execute the query by pressing the Run button, RethinkDB will create a new table and acknowledge the operation with a JSON document. As you can see, the Data Explorer is really easy to use and provides us with a great tool for high-level management of our databases and clusters.

Running a query

Congratulations, you've just executed your first ReQL query! You'll get to learn the ReQL query language much better in the following chapter.

Tip

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  • Log in or register to our website using your e-mail address and password
  • Hover the mouse pointer on the SUPPORT tab at the top
  • Click on Code Downloads & Errata
  • Enter the name of the book in the Search box
  • Select the book which you're looking to download the code files
  • Choose from the drop-down menu where you purchased this book from
  • Click on Code Download

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.111.243