Skip to content

Commit

Permalink
various fixes incl. addition of ycql quick start to ycql api section
Browse files Browse the repository at this point in the history
  • Loading branch information
Sid Choudhury committed Mar 15, 2019
1 parent d01a7fc commit e9d616c
Show file tree
Hide file tree
Showing 44 changed files with 294 additions and 48 deletions.
4 changes: 4 additions & 0 deletions content/latest/api/ycql/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ YCQL supports the following features.
- Builtin functions and Expression operators.
- Primitive user-defined datatypes.

## Quick Start

You can explore the basics of the YCQL API using the [Quick Start](quick-start/) steps.

## DDL Statements
Data definition language (DDL) statements are instructions for the following database operations.

Expand Down
138 changes: 138 additions & 0 deletions content/latest/api/ycql/quick-start/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
title: Quick Start YCQL
linkTitle: Quick Start YCQL
description: Quick Start
image: /images/section_icons/quick_start/explore_ycql.png
aliases:
- /quick-start/test-cassandra/
- /latest/quick-start/test-cassandra/
- /latest/quick-start/test-ycql/
menu:
latest:
parent: api-cassandra
weight: 1100
---

After [creating a local cluster](../../../quick-start/create-local-cluster/), follow the instructions below to explore the [YCQL](../) API.

[**cqlsh**](http://cassandra.apache.org/doc/latest/tools/cqlsh.html) is a command line shell for interacting with [CQL (the Cassandra Query Language)](http://cassandra.apache.org/doc/latest/cql/index.html) servers. It uses the Python driver, and connects to the single node specified on the command line. For ease of use, YugaByte DB ships with the 3.10 version of cqlsh in its bin directory.

## 1. Connect with cqlsh

<ul class="nav nav-tabs nav-tabs-yb">
<li >
<a href="#macos" class="nav-link active" id="macos-tab" data-toggle="tab" role="tab" aria-controls="macos" aria-selected="true">
<i class="fab fa-apple" aria-hidden="true"></i>
macOS
</a>
</li>
<li>
<a href="#linux" class="nav-link" id="linux-tab" data-toggle="tab" role="tab" aria-controls="linux" aria-selected="false">
<i class="fab fa-linux" aria-hidden="true"></i>
Linux
</a>
</li>
<li>
<a href="#docker" class="nav-link" id="docker-tab" data-toggle="tab" role="tab" aria-controls="docker" aria-selected="false">
<i class="fab fa-docker" aria-hidden="true"></i>
Docker
</a>
</li>
<li >
<a href="#kubernetes" class="nav-link" id="kubernetes-tab" data-toggle="tab" role="tab" aria-controls="kubernetes" aria-selected="false">
<i class="fas fa-cubes" aria-hidden="true"></i>
Kubernetes
</a>
</li>
</ul>

<div class="tab-content">
<div id="macos" class="tab-pane fade show active" role="tabpanel" aria-labelledby="macos-tab">
{{% includeMarkdown "binary/explore-ycql.md" /%}}
</div>
<div id="linux" class="tab-pane fade" role="tabpanel" aria-labelledby="linux-tab">
{{% includeMarkdown "binary/explore-ycql.md" /%}}
</div>
<div id="docker" class="tab-pane fade" role="tabpanel" aria-labelledby="docker-tab">
{{% includeMarkdown "docker/explore-ycql.md" /%}}
</div>
<div id="kubernetes" class="tab-pane fade" role="tabpanel" aria-labelledby="kubernetes-tab">
{{% includeMarkdown "kubernetes/explore-ycql.md" /%}}
</div>
</div>


## 2. Create a table

Create a keyspace called 'myapp'.

```sql
cqlsh> CREATE KEYSPACE myapp;
```


Create a table named 'stock_market' which can store stock prices at various timestamps for different stock ticker symbols.

```sql
cqlsh> CREATE TABLE myapp.stock_market (
stock_symbol text,
ts text,
current_price float,
PRIMARY KEY (stock_symbol, ts)
);
```


## 3. Insert data

Let us insert some data for a few stock symbols into our newly created 'stock_market' table. You can copy-paste these values directly into your cqlsh shell.

```sql
cqlsh> INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('AAPL','2017-10-26 09:00:00',157.41);
INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('AAPL','2017-10-26 10:00:00',157);
```

```sql
cqlsh> INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('FB','2017-10-26 09:00:00',170.63);
INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('FB','2017-10-26 10:00:00',170.1);
```

```sql
cqlsh> INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('GOOG','2017-10-26 09:00:00',972.56);
INSERT INTO myapp.stock_market (stock_symbol,ts,current_price) VALUES ('GOOG','2017-10-26 10:00:00',971.91);
```

## 4. Query the table

Query all the values we have inserted into the database for the stock symbol 'AAPL' as follows.

```sql
cqlsh> SELECT * FROM myapp.stock_market WHERE stock_symbol = 'AAPL';
```

```
stock_symbol | ts | current_price
--------------+---------------------+---------------
AAPL | 2017-10-26 09:00:00 | 157.41
AAPL | 2017-10-26 10:00:00 | 157
(2 rows)
```


Query all the values for 'FB' and 'GOOG' as follows.

```sql
cqlsh> SELECT * FROM myapp.stock_market WHERE stock_symbol in ('FB', 'GOOG');
```

```
stock_symbol | ts | current_price
--------------+---------------------+---------------
FB | 2017-10-26 09:00:00 | 170.63
FB | 2017-10-26 10:00:00 | 170.10001
GOOG | 2017-10-26 09:00:00 | 972.56
GOOG | 2017-10-26 10:00:00 | 971.90997
(4 rows)
```
29 changes: 29 additions & 0 deletions content/latest/api/ycql/quick-start/binary/explore-ycql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
---

- Run cqlsh to connect to the service.

You can do this as shown below.

```sh
$ ./bin/cqlsh localhost
```

```
Connected to local cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.9-SNAPSHOT | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
cqlsh>
```

- Run a cql command to verify it is working.

```sql
cqlsh> describe keyspaces;
```

```
system_schema system_auth system
cqlsh>
```
29 changes: 29 additions & 0 deletions content/latest/api/ycql/quick-start/docker/explore-ycql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
---

- Run cqlsh to connect to the service.

You can do this as shown below.

```sh
$ docker exec -it yb-tserver-n3 /home/yugabyte/bin/cqlsh
```

```
Connected to local cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.9-SNAPSHOT | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
cqlsh>
```

- Run a cql command to verify it is working.

```sql
cqlsh> describe keyspaces;
```

```
system_schema system_auth system
cqlsh>
```
27 changes: 27 additions & 0 deletions content/latest/api/ycql/quick-start/kubernetes/explore-ycql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
---

- Run cqlsh to connect to the service.

```sh
$ kubectl exec -it yb-tserver-0 /home/yugabyte/bin/cqlsh
```

```
Connected to local cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.9-SNAPSHOT | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
cqlsh>
```

- Run a cql command to verify it is working.

```sql
cqlsh> describe keyspaces;
```

```
system_schema system_auth system
cqlsh>
```
4 changes: 4 additions & 0 deletions content/latest/api/ysql/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ YSQL is a distributed SQL API that is compatible with the SQL dialect of Postgre

The main components of YSQL are data definition language (DDL), data manipulation language (DML), and data control language (DCL). A number of elements are used to construct these components including datatypes, database objects, names and qualifiers, expressions, and comments. Several other components are also provided for different purposes such as system control, transaction control, and performance tuning.

## Quick Start

You can explore the basics of the YSQL API using the [Quick Start](../../quick-start/explore-ysql) steps.

## Data Definition Language (DDL)
DDL commands define structures in the database, change their definitions, as well as remove them by using CREATE, ALTER, and DROP commands respectively.

Expand Down
17 changes: 15 additions & 2 deletions content/latest/architecture/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="col-12 col-md-6 col-lg-12 col-xl-6">
<a class="section-link icon-offset" href="design-goals/">
<div class="head">
<img class="icon" src="/images/section_icons/architecture/concepts.png" aria-hidden="true" />
<img class="icon" src="/images/section_icons/introduction/core_features.png" aria-hidden="true" />
<div class="title">Design Goals</div>
</div>
<div class="body">
Expand Down Expand Up @@ -51,10 +51,23 @@
</a>
</div>

<div class="col-12 col-md-6 col-lg-12 col-xl-6">
<a class="section-link icon-offset" href="query-layer/">
<div class="head">
<img class="icon" src="/images/section_icons/index/api.png" aria-hidden="true" />
<div class="articles">1 article</div>
<div class="title">Query Layer</div>
</div>
<div class="body">
Learn about the YugaByte Query Layer (YQL).
</div>
</a>
</div>

<div class="col-12 col-md-6 col-lg-12 col-xl-6">
<a class="section-link icon-offset" href="docdb/">
<div class="head">
<img class="icon" src="/images/section_icons/architecture/concepts.png" aria-hidden="true" />
<img class="icon" src="/images/section_icons/architecture/distributed_acid.png" aria-hidden="true" />
<div class="articles">4 articles</div>
<div class="title">DocDB Store</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions content/latest/architecture/concepts/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="col-12 col-md-6 col-lg-12 col-xl-6">
<a class="section-link icon-offset" href="yb-tserver/">
<div class="head">
<img class="icon" src="/images/section_icons/architecture/concepts/universe.png" aria-hidden="true" />
<img class="icon" src="/images/section_icons/admin/yb-tserver.png" aria-hidden="true" />
<div class="title">YB-TServer</div>
</div>
<div class="body">
Expand All @@ -40,9 +40,9 @@
</div>

<div class="col-12 col-md-6 col-lg-12 col-xl-6">
<a class="section-link icon-offset" href="universe/">
<a class="section-link icon-offset" href="yb-master/">
<div class="head">
<img class="icon" src="/images/section_icons/architecture/concepts/universe.png" aria-hidden="true" />
<img class="icon" src="/images/section_icons/admin/yb-master.png" aria-hidden="true" />
<div class="title">YB-Master</div>
</div>
<div class="body">
Expand Down
2 changes: 1 addition & 1 deletion content/latest/architecture/docdb/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div class="col-12 col-md-6 col-lg-12 col-xl-6">
<a class="section-link icon-offset" href="performance/">
<div class="head">
<img class="icon" src="/images/section_icons/explore/json_documents.png" aria-hidden="true" />
<img class="icon" src="/images/section_icons/explore/high_performance.png" aria-hidden="true" />
<div class="title">Performance</div>
</div>
<div class="body">
Expand Down
2 changes: 1 addition & 1 deletion content/latest/architecture/query-layer/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Query Layer
linkTitle: Query Layer
description: Query Layer
image: /images/section_icons/architecture/distributed_acid.png
image: /images/section_icons/index/api.png
headcontent:
aliases:
- /architecture/query-layer/
Expand Down
18 changes: 8 additions & 10 deletions content/latest/comparisons/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ Feature | [CockroachDB](https://www.yugabyte.com/yugabyte-db-vs-cockroachdb/) |
--------|-----------------|------------|----------------|----------------|-------------|-----------
Horizontal Write Scalability | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check">| <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Automated Failover &amp; Repair | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Auto Sharding | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Auto Rebalancing | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Auto Sharding & Rebalancing | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Distributed ACID Transactions | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
SQL Joins | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> |<i class="fas fa-times"></i>| <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Serializable Isolation Level | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i>
Consensus Driven Strongly Consistent Replication | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-times"> | <i class="fas fa-check"></i> |<i class="fas fa-check"></i>
Global Consistency Across Multi-DC/Regions | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-times"> | <i class="fas fa-check"></i> |<i class="fas fa-check"></i>
Multiple Read Consistency Levels | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
Low, Predictable p99 Latencies | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Expand All @@ -33,19 +31,19 @@ Open Source | Apache 2.0 | Apache 2.0 | <i class="fas fa-times"></i> | <i class=

## NoSQL Databases

Feature | [Apache Cassandra](cassandra/) | [MongoDB](mongodb/) | [FoundationDB](foundationdb/) |[Amazon DynamoDB](amazon-dynamodb/) | [MS Azure CosmosDB](azure-cosmos/)| YugaByte DB
Feature | [MongoDB](mongodb/) | [FoundationDB](foundationdb/) | [Apache Cassandra](cassandra/) |[Amazon DynamoDB](amazon-dynamodb/) | [MS Azure CosmosDB](azure-cosmos/)| YugaByte DB
--------|-----------|-------|--------|-------------|--------------|-----------------
Horizontal Write Scalability | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> |<i class="fas fa-check"></i>| <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Automated Failover &amp; Repair | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> |<i class="fas fa-check"></i>|<i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Auto Sharding | <i class="fas fa-check"></i> |<i class="fas fa-check"></i> |<i class="fas fa-check"></i>| <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Distributed ACID Transactions | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> |<i class="fas fa-check"></i>| <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
Consensus Driven Strongly Consistent Replication | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> |<i class="fas fa-check"></i>| <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
Strongly Consistent Secondary Indexes | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> |<i class="fas fa-check"></i>| <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
Auto Sharding & Rebalancing | <i class="fas fa-check"></i> |<i class="fas fa-check"></i> |<i class="fas fa-check"></i>| <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Distributed ACID Transactions | <i class="fas fa-times"></i> |<i class="fas fa-check"></i> | <i class="fas fa-times"></i>| <i class="fas fa-check"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
Consensus Driven Strongly Consistent Replication | <i class="fas fa-times"></i> |<i class="fas fa-check"></i> | <i class="fas fa-times"></i>| <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
Strongly Consistent Secondary Indexes | <i class="fas fa-times"></i> |<i class="fas fa-check"></i> | <i class="fas fa-times"></i>| <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
Multiple Read Consistency Levels | <i class="fas fa-check"></i> | <i class="fas fa-check"></i> |<i class="fas fa-check"></i>| <i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
Low, Predictable p99 Latencies | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> |<i class="fas fa-times"></i>|<i class="fas fa-check"></i> | <i class="fas fa-check"></i> | <i class="fas fa-check"></i>
High Data Density| <i class="fas fa-times"></i> | <i class="fas fa-times"></i> |<i class="fas fa-times"></i>| <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | <i class="fas fa-check"></i>
API | Cassandra QL | MongoDB QL | Proprietary KV, MongoDB QL| Proprietary KV, Document | Cassandra QL, MongoDB QL | YCQL w/ Cassandra QL roots
Open Source | Apache 2.0 | SSPL | Apache 2.0| <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | Apache 2.0
API | MongoDB QL | Proprietary KV, MongoDB QL | Cassandra QL | Proprietary KV, Document | Cassandra QL, MongoDB QL | YCQL w/ Cassandra QL roots
Open Source | SSPL | Apache 2.0 | Apache 2.0 | <i class="fas fa-times"></i> | <i class="fas fa-times"></i> | Apache 2.0

{{< note title="Note" >}}
The <i class="fas fa-check"></i> or <i class="fas fa-times"></i> with respect to any particular feature of a 3rd party database is based on our best effort understanding from publicly available information. Readers are always recommended to perform their own independent research to understand the finer details.
Expand Down
2 changes: 1 addition & 1 deletion content/latest/deploy/manual-deployment/start-masters.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Let us assume the following.

- We want to create a a 4 node cluster with replication factor `3`.
- We would need to run the YB-Master process on only three of the nodes say `node-a`, `node-b`, `node-c`
- Let us assume their IP addresses are `172.151.17.130`, `172.151.17.220` and `172.151.17.140`
- Let us assume their private IP addresses are `172.151.17.130`, `172.151.17.220` and `172.151.17.140`
- We have multiple data drives mounted on `/home/centos/disk1`, `/home/centos/disk2`

This section covers deployment for a single region/zone (or a single datacenter/rack). Execute the following steps on each of the instances.
Expand Down
Loading

0 comments on commit e9d616c

Please sign in to comment.