From 91dcce1a45f84bedd433b0573538870fa0b9dd00 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Fri, 1 Dec 2017 11:16:35 +0100 Subject: [PATCH 1/4] Removed some fully-removeable pages from Appendices --- docs/server/source/appendices/index.rst | 3 - .../source/appendices/install-with-lxd.md | 43 ------------- docs/server/source/appendices/pipelines.rst | 26 -------- .../source/appendices/rethinkdb-reqs.md | 61 ------------------- 4 files changed, 133 deletions(-) delete mode 100644 docs/server/source/appendices/install-with-lxd.md delete mode 100644 docs/server/source/appendices/pipelines.rst delete mode 100644 docs/server/source/appendices/rethinkdb-reqs.md diff --git a/docs/server/source/appendices/index.rst b/docs/server/source/appendices/index.rst index ae2052f0..5dd90ead 100755 --- a/docs/server/source/appendices/index.rst +++ b/docs/server/source/appendices/index.rst @@ -13,7 +13,6 @@ Appendices json-serialization cryptography the-Bigchain-class - pipelines backend commands aws-setup @@ -22,10 +21,8 @@ Appendices generate-key-pair-for-ssh firewall-notes ntp-notes - rethinkdb-reqs rethinkdb-backup licenses - install-with-lxd run-with-vagrant run-with-ansible vote-yaml diff --git a/docs/server/source/appendices/install-with-lxd.md b/docs/server/source/appendices/install-with-lxd.md deleted file mode 100644 index 969f6841..00000000 --- a/docs/server/source/appendices/install-with-lxd.md +++ /dev/null @@ -1,43 +0,0 @@ -# Installing BigchainDB on LXC containers using LXD - -**Note: This page was contributed by an external contributor and is not actively maintained. We include it in case someone is interested.** - -You can visit this link to install LXD (instructions here): [LXD Install](https://linuxcontainers.org/lxd/getting-started-cli/) - -(assumption is that you are using Ubuntu 14.04 for host/container) - -Let us create an LXC container (via LXD) with the following command: - -`lxc launch ubuntu:14.04 bigchaindb` - -(ubuntu:14.04 - this is the remote server the command fetches the image from) -(bigchaindb - is the name of the container) - -Below is the `install.sh` script you will need to install BigchainDB within your container. - -Here is my `install.sh`: - -``` -#!/bin/bash -set -ex -export DEBIAN_FRONTEND=noninteractive -apt-get install -y wget -source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list -wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add - -apt-get update -apt-get install -y rethinkdb python3-pip -pip3 install --upgrade pip wheel setuptools -pip install ptpython bigchaindb -``` - -Copy/Paste the above `install.sh` into the directory/path you are going to execute your LXD commands from (ie. the host). - -Make sure your container is running by typing: - -`lxc list` - -Now, from the host (and the correct directory) where you saved `install.sh`, run this command: - -`cat install.sh | lxc exec bigchaindb /bin/bash` - -If you followed the commands correctly, you will have successfully created an LXC container (using LXD) that can get you up and running with BigchainDB in <5 minutes (depending on how long it takes to download all the packages). diff --git a/docs/server/source/appendices/pipelines.rst b/docs/server/source/appendices/pipelines.rst deleted file mode 100644 index 8016e8cb..00000000 --- a/docs/server/source/appendices/pipelines.rst +++ /dev/null @@ -1,26 +0,0 @@ -######### -Pipelines -######### - -Block Creation -============== - -.. automodule:: bigchaindb.pipelines.block - - -Block Voting -============ - -.. automodule:: bigchaindb.pipelines.vote - - -Block Status -============ - -.. automodule:: bigchaindb.pipelines.election - - -Stale Transaction Monitoring -============================ - -.. automodule:: bigchaindb.pipelines.stale diff --git a/docs/server/source/appendices/rethinkdb-reqs.md b/docs/server/source/appendices/rethinkdb-reqs.md deleted file mode 100644 index 0d3468b7..00000000 --- a/docs/server/source/appendices/rethinkdb-reqs.md +++ /dev/null @@ -1,61 +0,0 @@ -# RethinkDB Requirements - -[The RethinkDB documentation](https://rethinkdb.com/docs/) should be your first source of information about its requirements. This page serves mostly to document some of its more obscure requirements. - -RethinkDB Server [will run on any modern OS](https://www.rethinkdb.com/docs/install/). Note that the Fedora package isn't officially supported. Also, official support for Windows is fairly recent ([April 2016](https://rethinkdb.com/blog/2.3-release/)). - - -## Storage Requirements - -When it comes to storage for RethinkDB, there are many things that are nice to have (e.g. SSDs, high-speed input/output [IOPS], replication, reliability, scalability, pay-for-what-you-use), but there are few _requirements_ other than: - -1. have enough storage to store all your data (and its replicas), and -2. make sure your storage solution (hardware and interconnects) can handle your expected read & write rates. - -For RethinkDB's failover mechanisms to work, [every RethinkDB table must have at least three replicas](https://rethinkdb.com/docs/failover/) (i.e. a primary replica and two others). For example, if you want to store 10 GB of unique data, then you need at least 30 GB of storage. (Indexes and internal metadata are stored in RAM.) - -As for the read & write rates, what do you expect those to be for your situation? It's not enough for the storage system alone to handle those rates: the interconnects between the nodes must also be able to handle them. - -**Storage Notes Specific to RethinkDB** - -* The RethinkDB storage engine has a number of SSD optimizations, so you _can_ benefit from using SSDs. ([source](https://www.rethinkdb.com/docs/architecture/)) - -* If you have an N-node RethinkDB cluster and 1) you want to use it to store an amount of data D (unique records, before replication), 2) you want the replication factor to be R (all tables), and 3) you want N shards (all tables), then each BigchainDB node must have storage space of at least R×D/N. - -* RethinkDB tables can have [at most 64 shards](https://rethinkdb.com/limitations/). What does that imply? Suppose you only have one table, with 64 shards. How big could that table be? It depends on how much data can be stored in each node. If the maximum amount of data that a node can store is d, then the biggest-possible shard is d, and the biggest-possible table size is 64 times that. (All shard replicas would have to be stored on other nodes beyond the initial 64.) If there are two tables, the second table could also have 64 shards, stored on 64 other maxed-out nodes, so the total amount of unique data in the database would be (64 shards/table)×(2 tables)×d. In general, if you have T tables, the maximum amount of unique data that can be stored in the database (i.e. the amount of data before replication) is 64×T×d. - -* When you set up storage for your RethinkDB data, you may have to select a filesystem. (Sometimes, the filesystem is already decided by the choice of storage.) We recommend using a filesystem that supports direct I/O (Input/Output). Many compressed or encrypted file systems don't support direct I/O. The ext4 filesystem supports direct I/O (but be careful: if you enable the data=journal mode, then direct I/O support will be disabled; the default is data=ordered). If your chosen filesystem supports direct I/O and you're using Linux, then you don't need to do anything to request or enable direct I/O. RethinkDB does that. - -

What is direct I/O? It allows RethinkDB to write directly to the storage device (or use its own in-memory caching mechanisms), rather than relying on the operating system's file read and write caching mechanisms. (If you're using Linux, a write-to-file normally writes to the in-memory Page Cache first; only later does that Page Cache get flushed to disk. The Page Cache is also used when reading files.)

- -* RethinkDB stores its data in a specific directory. You can tell RethinkDB _which_ directory using the RethinkDB config file, as explained below. In this documentation, we assume the directory is `/data`. If you set up a separate device (partition, RAID array, or logical volume) to store the RethinkDB data, then mount that device on `/data`. - - -## Memory (RAM) Requirements - -In their [FAQ](https://rethinkdb.com/faq/), RethinkDB recommends that, "RethinkDB servers have at least 2GB of RAM..." ([source](https://rethinkdb.com/faq/)) - -In particular: "RethinkDB requires data structures in RAM on each server proportional to the size of the data on that server’s disk, usually around 1% of the size of the total data set." ([source](https://rethinkdb.com/limitations/)) We asked what they meant by "total data set" and [they said](https://github.com/rethinkdb/rethinkdb/issues/5902#issuecomment-230860607) it's "referring to only the data stored on the particular server." - -Also, "The storage engine is used in conjunction with a custom, B-Tree-aware caching engine which allows file sizes many orders of magnitude greater than the amount of available memory. RethinkDB can operate on a terabyte of data with about ten gigabytes of free RAM." ([source](https://www.rethinkdb.com/docs/architecture/)) (In this case, it's the _cluster_ which has a total of one terabyte of data, and it's the _cluster_ which has a total of ten gigabytes of RAM. That is, if you add up the RethinkDB RAM on all the servers, it's ten gigabytes.) - -In reponse to our questions about RAM requirements, @danielmewes (of RethinkDB) [wrote](https://github.com/rethinkdb/rethinkdb/issues/5902#issuecomment-230860607): - -> ... If you replicate the data, the amount of data per server increases accordingly, because multiple copies of the same data will be held by different servers in the cluster. - -For example, if you increase the data replication factor from 1 to 2 (i.e. the primary plus one copy), then that will double the RAM needed for metadata. Also from @danielmewes: - -> **For reasonable performance, you should probably aim at something closer to 5-10% of the data size.** [Emphasis added] The 1% is the bare minimum and doesn't include any caching. If you want to run near the minimum, you'll also need to manually lower RethinkDB's cache size through the `--cache-size` parameter to free up enough RAM for the metadata overhead... - -RethinkDB has [documentation about its memory requirements](https://rethinkdb.com/docs/memory-usage/). You can use that page to get a better estimate of how much memory you'll need. In particular, note that RethinkDB automatically configures the cache size limit to be about half the available memory, but it can be no lower than 100 MB. As @danielmewes noted, you can manually change the cache size limit (e.g. to free up RAM for queries, metadata, or other things). - -If a RethinkDB process (on a server) runs out of RAM, the operating system will start swapping RAM out to disk, slowing everything down. According to @danielmewes: - -> Going into swap is usually pretty bad for RethinkDB, and RethinkDB servers that have gone into swap often become so slow that other nodes in the cluster consider them unavailable and terminate the connection to them. I recommend adjusting RethinkDB's cache size conservatively to avoid this scenario. RethinkDB will still make use of additional RAM through the operating system's block cache (though less efficiently than when it can keep data in its own cache). - - -## Filesystem Requirements - -RethinkDB "supports most commonly used file systems" ([source](https://www.rethinkdb.com/docs/architecture/)) but it has [issues with BTRFS](https://github.com/rethinkdb/rethinkdb/issues/2781) (B-tree file system). - -It's best to use a filesystem that supports direct I/O, because that will improve RethinkDB performance (if you tell RethinkDB to use direct I/O). Many compressed or encrypted filesystems don't support direct I/O. From 1a5bb073e346d0eddfb5ac465c1c26f72980de73 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Fri, 1 Dec 2017 15:27:55 +0100 Subject: [PATCH 2/4] Remove rethinkdb-backup.md --- docs/server/source/appendices/index.rst | 4 - .../source/appendices/rethinkdb-backup.md | 124 ------------------ 2 files changed, 128 deletions(-) delete mode 100644 docs/server/source/appendices/rethinkdb-backup.md diff --git a/docs/server/source/appendices/index.rst b/docs/server/source/appendices/index.rst index 5dd90ead..35f3238b 100755 --- a/docs/server/source/appendices/index.rst +++ b/docs/server/source/appendices/index.rst @@ -1,6 +1,3 @@ -.. You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - Appendices ========== @@ -21,7 +18,6 @@ Appendices generate-key-pair-for-ssh firewall-notes ntp-notes - rethinkdb-backup licenses run-with-vagrant run-with-ansible diff --git a/docs/server/source/appendices/rethinkdb-backup.md b/docs/server/source/appendices/rethinkdb-backup.md deleted file mode 100644 index dc33231e..00000000 --- a/docs/server/source/appendices/rethinkdb-backup.md +++ /dev/null @@ -1,124 +0,0 @@ -# Backing Up and Restoring Data - -This page was written when BigchainDB only worked with RethinkDB, so its focus is on RethinkDB-based backup. BigchainDB now supports MongoDB as a backend database and we recommend that you use MongoDB in production. Nevertheless, some of the following backup ideas are still relevant regardless of the backend database being used, so we moved this page to the Appendices. - - -## RethinkDB's Replication as a form of Backup - -RethinkDB already has internal replication: every document is stored on _R_ different nodes, where _R_ is the replication factor (set using `bigchaindb set-replicas R`). Those replicas can be thought of as "live backups" because if one node goes down, the cluster will continue to work and no data will be lost. - -At this point, there should be someone saying, "But replication isn't backup!" - -It's true. Replication alone isn't enough, because something bad might happen _inside_ the database, and that could affect the replicas. For example, what if someone logged in as a RethinkDB admin and did a "drop table"? We currently plan for each node to be protected by a next-generation firewall (or something similar) to prevent such things from getting very far. For example, see [issue #240](https://github.com/bigchaindb/bigchaindb/issues/240). - -Nevertheless, you should still consider having normal, "cold" backups, because bad things can still happen. - - -## Live Replication of RethinkDB Data Files - -Each BigchainDB node stores its subset of the RethinkDB data in one directory. You could set up the node's file system so that directory lives on its own hard drive. Furthermore, you could make that hard drive part of a [RAID](https://en.wikipedia.org/wiki/RAID) array, so that a second hard drive would always have a copy of the original. If the original hard drive fails, then the second hard drive could take its place and the node would continue to function. Meanwhile, the original hard drive could be replaced. - -That's just one possible way of setting up the file system so as to provide extra reliability. - -Another way to get similar reliability would be to mount the RethinkDB data directory on an [Amazon EBS](https://aws.amazon.com/ebs/) volume. Each Amazon EBS volume is, "automatically replicated within its Availability Zone to protect you from component failure, offering high availability and durability." - -As with shard replication, live file-system replication protects against many failure modes, but it doesn't protect against them all. You should still consider having normal, "cold" backups. - - -## rethinkdb dump (to a File) - -RethinkDB can create an archive of all data in the cluster (or all data in specified tables), as a compressed file. According to [the RethinkDB blog post when that functionality became available](https://rethinkdb.com/blog/1.7-release/): - -> Since the backup process is using client drivers, it automatically takes advantage of the MVCC [multiversion concurrency control] functionality built into RethinkDB. It will use some cluster resources, but will not lock out any of the clients, so you can safely run it on a live cluster. - -To back up all the data in a BigchainDB cluster, the RethinkDB admin user must run a command like the following on one of the nodes: -```text -rethinkdb dump -e bigchain.bigchain -e bigchain.votes -``` - -That should write a file named `rethinkdb_dump__