Skip to content

Commit 7ebe49f

Browse files
authored
Merge pull request #204334 from iriaosara/cqlshupdate
Updating cqlsh copy
2 parents 23a1587 + 81fe6c5 commit 7ebe49f

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

articles/cosmos-db/cassandra/cassandra-support.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,30 @@ You can connect to the Cassandra API in Azure Cosmos DB by using the CQLSH insta
247247
248248
**Windows:**
249249

250-
If using windows, we recommend you enable the [Windows filesystem for Linux](/windows/wsl/install-win10#install-the-windows-subsystem-for-linux). You can then follow the linux commands below.
250+
<!-- If using windows, we recommend you enable the [Windows filesystem for Linux](/windows/wsl/install-win10#install-the-windows-subsystem-for-linux). You can then follow the linux commands below. -->
251+
252+
1. Install [Python 2.7](https://www.python.org/downloads/release/python-2718/)
253+
1. Select the Windows x86-64 MSI installer version
254+
1. Install PIP
255+
1. Before install PIP, download the get-pip.py file.
256+
1. Launch a command prompt if it isn't already open. To do so, open the Windows search bar, type cmd and select the icon.
257+
1. Then, run the following command to download the get-pip.py file:
258+
```bash
259+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
260+
```
261+
1. Install PIP on Windows
262+
```bash
263+
python get-pip.py
264+
```
265+
1. Verify the PIP installation (look for a message from step 3 to confirm which folder PIP was installed in and then navigate to that folder and run the command pip help).
266+
1. Install CQLSH using PIP
267+
```bash
268+
pip3 install cqlsh==5.0.3
269+
```
270+
1. Run the [CQLSH using the authentication mechanism](manage-data-cqlsh.md#update-your-connection-string).
271+
272+
> [!NOTE]
273+
> You would need to set the environment variables to point to the Python27 folder.
251274

252275
**Install on Unix/Linux/Mac:**
253276

articles/cosmos-db/cassandra/migrate-data.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,35 @@ Use the [CQL COPY command](https://cassandra.apache.org/doc/latest/cassandra/too
9696
```bash
9797
COPY exampleks.tablename FROM 'data.csv' WITH HEADER = TRUE;
9898
```
99+
> [!NOTE]
100+
> Cassandra API supports protocol version 4, which shipped with Cassandra 3.11. There may be issues with using later protocol versions with our API. COPY FROM with later protocol version can go into a loop and return duplicate rows.
101+
> Add the protocol-version to the cqlsh command.
102+
```sql
103+
cqlsh <USERNAME>.cassandra.cosmos.azure.com 10350 -u <USERNAME> -p <PASSWORD> --ssl --protocol-version=4
104+
```
105+
##### Add throughput-limiting options to CQL Copy command
106+
107+
The COPY command in cqlsh supports various parameters to control the rate of ingestion of documents into Azure Cosmos DB.
108+
109+
The default configuration for COPY command tries to ingest data at very fast pace and does not account for the rate-limiting behavior of CosmosDB. You should reduce the CHUNKSIZE or INGESTRATE depending on the throughput configured on the collection.
110+
111+
We recommend the below configuration (at minimum) for a collection at 20,000 RUs if the document or record size is 1 KB.
112+
113+
- CHUNKSIZE = 100
114+
- INGESTRATE = 500
115+
- MAXATTEMPTS = 10
116+
117+
###### Example commands
118+
119+
- Copying data from Cassandra API to local csv file
120+
```sql
121+
COPY standard1 (key, "C0", "C1", "C2", "C3", "C4") TO 'backup.csv' WITH PAGESIZE=100 AND MAXREQUESTS=1 ;
122+
```
123+
124+
- Copying data from local csv file to Cassandra API
125+
```sql
126+
COPY standard2 (key, "C0", "C1", "C2", "C3", "C4") FROM 'backup.csv' WITH CHUNKSIZE=100 AND INGESTRATE=100 AND MAXATTEMPTS=10;
127+
```
99128

100129
>[!IMPORTANT]
101130
> Only the open-source Apache Cassandra version of CQLSH COPY is supported. Datastax Enterprise (DSE) versions of CQLSH may encounter errors.

0 commit comments

Comments
 (0)