Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2701,"date":"2019-12-08T23:38:28","date_gmt":"2019-12-08T23:38:28","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2701"},"modified":"2019-12-11T00:34:38","modified_gmt":"2019-12-11T00:34:38","slug":"setup-rethinkdb-cluster-on-ubuntu-14","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/setup-rethinkdb-cluster-on-ubuntu-14\/","title":{"rendered":"Setup RethinkDB Cluster On Ubuntu 14"},"content":{"rendered":"

Introduction<\/h3>\n

RethinkDB is a NoSQL database that stores data as JSON documents. It has a super intuitive query language and has features commonly available in traditional RDBMS like “table joins” and “group by”. This tutorial will explain how to setup a RethinkDB cluster using 3 AKLWEB HOST VPS servers running Ubuntu 14.04.<\/p>\n

Installation<\/h3>\n

Create a new AKLWEB HOST startup script using the following content as a template.<\/p>\n

#!\/usr\/bin\/env bash\r\n\r\necho \">>> Installing RethinkDB<<<\"\r\n\r\n# Add RethinkDB Repo to list of Repos\r\nsource \/etc\/lsb-release && echo \"deb http:\/\/download.rethinkdb.com\/apt $DISTRIB_CODENAME main\" | sudo tee \/etc\/apt\/sources.list.d\/rethinkdb.list\r\nwget -qO- http:\/\/download.rethinkdb.com\/apt\/pubkey.gpg | sudo apt-key add -\r\n\r\n# Update Apt Repo & Install RethinkDB\r\nsudo apt-get update\r\nsudo apt-get install -qq rethinkdb\r\n<\/code><\/pre>\n

Spin up a AKLWEB HOST VM instance by picking any\u00a0Server Type<\/em>,\u00a0Location<\/em>, and\u00a0Server Size<\/em>\u00a0of your choice. For the choice of\u00a0Operating System<\/em>, make sure to select\u00a0Ubuntu 14.04 x64<\/strong>\u00a0and check the\u00a0Enable Private Network<\/strong>\u00a0option. Also\u00a0MAKE SURE<\/strong>\u00a0to select the startup script created above before placing your order.<\/p>\n

Connect To Your New VM Instance<\/h3>\n

Once your new VM instance is ready, connect to it from a terminal\/command-prompt via SSH.<\/p>\n

ssh root@[aklwebhost-ip-address]\r\n<\/code><\/pre>\n

When prompted for your password, use the initial password under “server info” tab from AKLWEB HOST admin.<\/p>\n

You can update your password by typing\u00a0passwd<\/code>\u00a0and hitting the\u00a0ENTER<\/strong>\u00a0key. Ubuntu will prompt you for a new password (this way you can choose something that you easily remember).<\/p>\n

Accessing Database<\/h3>\n

Start RethinkDB by running command below. Note that we’re “binding to all” so that we don’t run into issues when trying to access RethinkDB’s web admin interface.<\/p>\n

rethinkdb --bind all\r\n<\/code><\/pre>\n

Once RethinkDB is started, you access it either by command-line or a web interface.<\/p>\n

Web Access<\/h4>\n

To access via web, use port\u00a08080<\/strong>\u00a0by typing\u00a0http:\/\/[aklwebhost-ip-address]:8080<\/code>\u00a0in the address bar of your web browser. You should see RethinkDB’s awesome web administration tool.<\/p>\n

Command-Line Access<\/h4>\n

To access via command-line, start a new terminal\/command-prompt session and connect to the server via SSH as explained previously. Then, issue the command\u00a0rethinkdb admin join 127.0.0.1:29015<\/code>. Make sure to use port\u00a029015<\/strong>.<\/p>\n

Remove Test Database<\/h3>\n

We will be using the web interface going forward to manipulate the database. Access it by browsing to\u00a0http:\/\/[aklwebhost-ip-address]:8080<\/code>\u00a0and click on the “Tables” link. You will see that RethinkDB already installed a “test” database. Click on the “Data Explorer” link and run below command to delete the “test” database.<\/p>\n

r.dbDrop('test')\r\n<\/code><\/pre>\n

Playing Around in Database<\/h3>\n

While still on the “Data Explorer” section of RethinkDB’s admin, create a new database named “tweetDB” by running the code below.<\/p>\n

r.dbCreate('tweetDB')\r\n<\/code><\/pre>\n

Next, create a “tweets” table.<\/p>\n

r.db('tweetDB').tableCreate('tweets')\r\n<\/code><\/pre>\n

Insert some records into the “tweets” table.<\/p>\n

r.db('tweetDB').table('tweets').insert([\r\n    {\r\n        name: 'Lami',\r\n        twitterHandle: 'mrLami',\r\n        message: 'Best cloud hosting on the planet - aklwebhost'\r\n    },\r\n    {\r\n        name: 'AKLWEB HOST',\r\n        twitterHandle: '@aklwebhost',\r\n        message: '50% off on new instances - coupon - tgif'\r\n    }\r\n])\r\n<\/code><\/pre>\n

Query “tweets” table to see results.<\/p>\n

r.db('tweetDB').table('tweets')\r\n<\/code><\/pre>\n

You should see the following under tree view (with different id’s).<\/p>\n

[\r\n    {\r\n        \"id\":  \"6afe436c-7db4-4c86-b4db-3279acb3265d\" ,\r\n        \"message\":  \"50% off on new instances - coupon - tgif\" ,\r\n        \"name\":  \"AKLWEB HOST\" ,\r\n        \"twitterHandle\":  \"@aklwebhost\"\r\n    } ,\r\n    {\r\n        \"id\":  \"fd328cd5-d9f4-40ee-8a32-880cd8cda15d\" ,\r\n        \"message\":  \"Best cloud hosting on the planet - aklwebhost\" ,\r\n        \"name\":  \"Lami\" ,\r\n        \"twitterHandle\":  \"mrLami\"\r\n    }\r\n]\r\n<\/code><\/pre>\n

Setting Up Cluster<\/h3>\n

Spin up a second and third machine using instructions from the\u00a0“Installation”<\/em>,\u00a0“Connect To Your New VM Instance”<\/em>\u00a0and\u00a0“Accessing Database”<\/em>\u00a0sections of this guide. Make sure to delete the “test” database on each of the new instances, and\u00a0DO NOT<\/strong>\u00a0add any new databases to them.<\/p>\n

After deleting the “test” database from second and third instances, go back to their command prompts and stop RethinkDB by issuing\u00a0Ctrl + C<\/strong>\u00a0(or\u00a0Cmd + C<\/strong>\u00a0on Mac). Now start RethinkDB again on these instances by using the below command (we’re basically telling new second and third instances to join the first).<\/p>\n

$ rethinkdb --join [ip-of-first-aklwebhost-vm]:29015 --bind all\r\n<\/code><\/pre>\n

On the second and third instances, access web admin interfaces, and go to the “Data Explorer” section. Run the following query to get a list of tweets.<\/p>\n

 r.db('tweetDB').table('tweets')\r\n<\/code><\/pre>\n

You will see that they have already replicated from the master (first VM setup) instance.<\/p>\n

Conclusion<\/h3>\n

Although RethinkDB is still in its infancy at the time of this writing, it holds a lot of promise and has a powerful web-based administration interface that makes arduous tasks usually involved with scaling a database (sharding, replication) easily accomplished with just a few clicks.<\/p>\n

For further reading, visit the\u00a0RethinkDB Docs<\/span><\/a>. Also check out #rethinkdb IRC channel to learn more from the community.<\/p>\n

Other Versions<\/h4>\n

CentOS 7<\/a><\/strong><\/span><\/p>\n

Written by Lami Adabonyan<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[242,247],"manual_kb_tag":[402],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2701"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2701"}],"version-history":[{"count":4,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2701\/revisions"}],"predecessor-version":[{"id":2720,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2701\/revisions\/2720"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2701"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2701"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}