Skip to content

Commit f7424c2

Browse files
committed
Add version 0.6.0
1 parent 79d5551 commit f7424c2

37 files changed

+1922
-2290
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"clear": "docusaurus clear"
1313
},
1414
"dependencies": {
15-
"@docusaurus/core": "2.0.0-alpha.72",
16-
"@docusaurus/preset-classic": "2.0.0-alpha.72",
15+
"@docusaurus/core": "^2.0.0-beta.0",
16+
"@docusaurus/preset-classic": "^2.0.0-beta.0",
1717
"@mdx-js/react": "^1.6.21",
1818
"clsx": "^1.1.1",
1919
"docusaurus-plugin-auto-sidebars": "^1.0.7",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
id: index
3+
title: Introduction
4+
sidebar_label: Home
5+
slug: /
6+
---
7+
Welcome to Skytable's docs! You will find information about how you can get started with Skytable, installation options, configuration and clients.
8+
9+
## Users
10+
11+
We have an easy-to-follow guide for [Getting Started](getting-started). Once you've got everything up and running, you can take a look at the available actions [here](actions-overview) and [configuration files](config-files).
12+
Once you've learned the basics, start using a [client driver](clients)!
13+
14+
## Developers
15+
16+
You can find information on how to build your own clients [here](protocol/skyhash). The primary idea is to implement the Skyhash Protocol.
17+
18+
## Contributing
19+
20+
If you find any typos, mistakes or any other scope of improvement - please don't hesitate to bring it up [here](https://github.com/skytable/docs/issues). Thank you ❤️!
21+
22+
## License
23+
24+
The documentation is licensed under the [CC-BY-SA-4.0 License](https://github.com/skytable/docs/tree/master/LICENSE)
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
id: getting-started
3+
title: Getting Started
4+
---
5+
Getting started with Skytable is easy 😊 (and fun!). You can get started with [native binaries (recommended)](#get-started-with-bundles) or by using the [docker image](#get-started-with-docker).
6+
7+
## Get started with bundles
8+
9+
### Step 1: Download a bundle
10+
11+
Head over to this [page](https://github.com/skytable/skytable/releases/v0.6.0) and download a version for your platform.
12+
13+
### Step 2: Make the files runnable
14+
15+
Unzip the `zip` file that you just downloaded. If you're on a *nix system, run `chmod +x skyd skysh` to make the files executable. If you're on Windows, right-click the files and then check the `UNBLOCK` checkbox and click on the `APPLY` button.
16+
17+
### Step 3: Start the database server
18+
19+
In the directory where you extracted the files, run `./skyd` on *nix systems or simply `skyd` on Windows systems. That's all there is to starting the database server!
20+
21+
### Step 4: Run the shell `skysh`
22+
23+
`skysh` is the shell that is shipped with the bundle. Run it, just like you did with the database server. Now enter commands in the shell, and have fun! First run `HEYA` to check if everything is fine - the server should reply with _HEY!_.
24+
See all the available actions [here](actions-overview).
25+
26+
You're done with setting up `skyd` 🎉!
27+
28+
## Get started with Docker
29+
30+
First of all, you need to have Docker installed and available on your `PATH` ; you can read the official guide [here](https://docs.docker.com/get-docker/). Once you've got Docker up and running, follow the steps!
31+
32+
### Step 0: Create a container
33+
34+
Open up a terminal and run:
35+
36+
```
37+
docker create skytable/sdb:v0.6.0 --name skyvm
38+
```
39+
40+
:::note
41+
You may need superuser privileges
42+
:::
43+
At the same time, you'll need to set up the bundle by following [Step 1](#step-1-download-a-bundle) and [Step 2](#step-2-make-the-files-runnable) from the previous section.
44+
45+
### Step 1: Start the container
46+
47+
Now run:
48+
49+
```
50+
docker start skyvm
51+
```
52+
53+
:::note
54+
You may need superuser privileges
55+
:::
56+
57+
### Step 2: Find the IP address of the container
58+
59+
In order to connect to the container (which, to `skysh` is nothing but a remote server), you'll have to run:
60+
61+
``` shell
62+
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' skyvm
63+
```
64+
65+
:::note
66+
You may need superuser privileges
67+
:::
68+
And you'll get a result like:
69+
70+
``` text
71+
172.17.0.1
72+
```
73+
74+
### Step 3: Start the command line client
75+
76+
Open up a terminal in the directory where you downloaded the command line client and run:
77+
78+
``` shell
79+
skysh -h 172.17.0.1
80+
```
81+
82+
And you're done!
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
id: building-from-source
3+
title: Building from source
4+
---
5+
Of course you can build it from source — but with quite a bit of hassle. The database server is a bit fussy with its builds, so you'll need quite a few tools before you can actually start using it.
6+
7+
### Step 1: Install pre-requisites
8+
As Skytable is written in Rust, you'll have to install the Rust toolchain to build it (a little messy, but not too messy). Go to [this page](https://rustup.rs/) to set up Rust on your local machine.
9+
10+
Besides, the TLS/SSL components are written in C (OpenSSL) — so you'll need to install:
11+
* A C compiler for your platform
12+
* GNU Make (`make`)
13+
* Perl
14+
15+
### Step 2: Clone the tag
16+
Run this from your terminal:
17+
```
18+
git clone --branch v0.6.0 https://github.com/skytable/skytable.git
19+
```
20+
:::tip Bonus tip
21+
If you want to avoid downloading all the version history, run this instead:
22+
```
23+
git clone --depth 1 --branch v0.6.0 https://github.com/skytable/skytable.git
24+
```
25+
:::
26+
### Step 3: Build it!
27+
Expecting that you're still in the same directory, run:
28+
```
29+
cd skybase && cargo build --release
30+
```
31+
:::note
32+
This will take **crazy long** at times, so hold on until Cargo finishes building things
33+
:::
34+
35+
### Step 4: Get the binaries
36+
You'll need to copy `skyd` and `skysh` (or `skyd.exe` and `skysh.exe` if on Windows) from the `skybase/target/release` folder. Be sure to copy these **exact files** and not something else!
37+
### Step 5: Run it!
38+
Now start the database server by running `./skyd` and then start the interactive shell by running `./skysh`. You're ready to use the [actions](actions-overview)!
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
id: persistence
3+
title: Persistence
4+
---
5+
Skytable supports the persistent storage of data, which is an inherently obvious need for any database. In this document we explore how Skytable's persistence works.
6+
7+
## Data directory structure
8+
9+
Whenever you start Skytable, it will create a number of directories under a root 'data' directory. This is what the
10+
data directory structure looks like:
11+
```
12+
|__user-files (your other files)
13+
|__data
14+
|__data.bin
15+
|__snapshots
16+
|__<YYYYMMDD>-<HHMMSS>.snapshot (many)
17+
|__remote
18+
|___<snapshotname>.snapshot (many)
19+
```
20+
21+
The `data.bin` file is primarily used for persistence while the snapshots folder contains automatically created
22+
snapshots and remotely created snapshots.
23+
24+
## How Skytable stores data
25+
26+
As soon as you start Skytable, it will look for a `data.bin` file in the data directory and then fall back to the
27+
`data.bin` file in the current directory for backwards compatibility. The database daemon will then attempt to
28+
migrate the older data into the structure noted above if required.
29+
:::note
30+
This backward compatibility will possibly be removed in future releases
31+
:::
32+
If the data file is found and successfully read, then the previous data is moved into the in-memory table. If no
33+
file was found, then the database server will create one. Once you terminate the daemon, it will flush all data
34+
to this file. There are more features like [BGSAVE](#automated-background-saving) and [snapshots](/snapshots) that
35+
can be configured and used by users.
36+
37+
38+
## Automated background saving
39+
40+
Skytable supports automated saving of data in the background, via `BGSAVE`. `BGSAVE`, runs every two minutes to flush all the data in the in-memory table onto disk, unless customized through the [configuration file](config-files/#an-example-configuration). BGSAVE is enabled by default and we don't recommend disabling it until you're sure that
41+
your hardware will never fail; it is likely that this will never be the case.
42+
43+
### Reliability of BGSAVE
44+
45+
It can happen that BGSAVE fails to flush data to the disk due to some unforeseen system issues (such as lack of
46+
empty disk space, permission errors, etc). But if we continue to accept modifications to the data, it is a bad idea
47+
because this data may never get updated! This is why if BGSAVE fails, it will automatically _poison_ the in-memory
48+
table preventing it from accepting any write/update operations. Poisioning is nothing but a global flag set in the
49+
database that indicates that the DB shouldn't accept any more updates/writes to data and in such a poisoned state,
50+
only reads are permitted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
id: benchmarking
3+
title: Benchmarking
4+
---
5+
Who doesn't like speed and as a consequence, benchmarks? So here's a guide on benchmarking Skytable with our tool `sky-bench` .
6+
7+
## Step 0: Getting the benchmarking tool
8+
9+
You'll need to download a bundle from the [releases page](https://github.com/skytable/skytable/releases/v0.6.0) and unzip it. In the following steps we'll assume that you have unzipped the archive and you're in that directory.
10+
11+
## Step 1: Starting the database server
12+
13+
Open a terminal in the current directory and [set executable permissions](getting-started#step-2-make-the-files-runnable). Now start the server by running `./skyd` (or just `skyd` on Windows).
14+
15+
## Step 2: Run the benchmark tool
16+
17+
Open another terminal in the current directory and then run `sky-bench` with no arguments if you want to use the default options, or run `sky-bench --help` to see available configuration options. Hold tight, you'll know when it happens 🚀.
18+
19+
:::tip Tip
20+
**JSON Output**
21+
If you're a bit nerdy, we know it — you'll like some structured data. Well, all you need to do is: run `sky-bench --json` for JSON output!
22+
:::
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
id: config-files
3+
title: Configuration Files
4+
---
5+
Skytable supports custom configuration files to let users customize the functioning of Sky. Arguably, Sky has one of the simplest configuration files around. Skytable also allows configuration via [command line arguments](config-cmd).
6+
7+
## An example configuration
8+
9+
A configuration file is a TOML file, which looks like:
10+
11+
``` toml
12+
[server]
13+
host = "127.0.0.1"
14+
port = 2003
15+
noart = false
16+
17+
[bgsave]
18+
enabled = true
19+
every = 120 # Every 120 seconds
20+
```
21+
22+
This is the default configuration used by Sky when you don't specify a configuration file. Let's understand what each of the keys mean:
23+
24+
* `server` :
25+
- `host` : This is the IP address to which you want the database server to bind to. It can be any valid IPv4 *or* IPv6 address, as a quoted string
26+
- `port` : This is the port to which you want Sky to bind to
27+
- `noart` (OPTIONAL): This is **an optional argument** and is recommended for secure environments where displaying terminal artwork might cause problems
28+
* `bgsave`:
29+
- `enabled` : This is an optional key, which is to be set to true to enable BGSAVE or false to disable it. If this key is not specified, Sky will enable BGSAVE by default
30+
- `every` : Run BGSAVE `every` seconds. So, for example, if you set this to 120, BGSAVE will run every two minutes. This is also an optional key, and if you don't provide it, the default BGSAVE duration of 120 seconds is used
31+
* `snapshot` (OPTIONAL): This key can be used to configure snapshots and is not enabled by default. See [this](snapshots) for more information.
32+
* `ssl`: This key can be used to configure SSL/TLS options. See [this](ssl) for more information.
33+
34+
## Using a configuration file
35+
36+
To use a configuration file:
37+
38+
1. Create it! We recommend you to name it as `skyd.toml` for easy identification
39+
2. Start the database server with: `skyd -c /path/to/your/file.toml`
40+
3. Done 🎉
41+
42+
If you're confused about creating a configuration file, we always recommend you to download a sample file from [this link](https://github.com/skytable/skytable/blob/next/examples/config-files/template.toml). Do note that this file is bleeding-edge and as a result will have new keys as they're created upstream.
43+
44+
That's all that's there for using configuration files!
45+
:::tip Bonus tip
46+
If you're using a custom host/port, then you can bind `skysh` to a custom host/port by starting `skysh` like:
47+
```shell
48+
skysh -h [HOST] -p [PORT]
49+
```
50+
You can do the same for `sky-bench`:
51+
```shell
52+
sky-bench -h [HOST] -p [PORT]
53+
```
54+
:::
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
id: actions-overview
3+
title: Actions overview
4+
---
5+
Actions are like shell commands: they take arguments and do something! Skytable currently supports the following actions:
6+
7+
* [DBSIZE](actions/DBSIZE.md)
8+
* [DEL](actions/DEL.md)
9+
* [EXISTS](actions/EXISTS.md)
10+
* [FLUSHDB](actions/FLUSHDB.md)
11+
* [GET](actions/GET.md)
12+
* [KEYLEN](actions/KEYLEN.md)
13+
* [LSKEYS](actions/LSKEYS.md)
14+
* [MGET](actions/MGET.md)
15+
* [MKSNAP](actions/MKSNAP.md)
16+
* [MSET](actions/MSET.md)
17+
* [MUPDATE](actions/MUPDATE.md)
18+
* [SDEL](actions/SDEL.md)
19+
* [SET](actions/SET.md)
20+
* [SSET](actions/SSET.md)
21+
* [SUPDATE](actions/SUPDATE.md)
22+
* [UPDATE](actions/UPDATE.md)
23+
* [USET](actions/USET.md)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: dbsize
3+
title: DBSIZE
4+
---
5+
:::note About
6+
**Time complexity**: O(1)
7+
**Arguments**: `DBSIZE`
8+
**Returns**: Number of keys that exist in the database as an unsigned int
9+
:::
10+
Number of key/value pairs stored in the database
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
id: del
3+
title: DEL
4+
---
5+
:::note About
6+
**Time complexity**: O(n)
7+
**Arguments**: `DEL <key1> <key2> ...`
8+
**Returns**: Number of keys that were deleted as an unsigned int
9+
:::
10+
Delete 'n' keys

0 commit comments

Comments
 (0)