在Mac上本地搭建Cassandra

概要:

Cassandra在本地的配置备忘录。我想在本地运行Cassandra,所以记录下必要的步骤。

步骤

准备Cassandra实体

这次尝试在Docker上运行

version: '2'
services:
  cassandra:
      image: cassandra:3.9
      container_name: cassandra
      ports:
        - "9042:9042"
      environment:
        - "MAX_HEAP_SIZE=256M"
        - "HEAP_NEWSIZE=128M"
      restart: always
      volumes:
        - ./out/cassandra_data:/var/lib/cassandra0

※ 具體的設定可隨時更改

安装CQL(Cassandra版SQL)。

安装 pip

如果已安装则跳过 OK

$ sudo easy_install pip

2. 使用pip安装CQL

$ sudo pip install cql

在我的环境中,出现了以下错误。

ERROR: Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

加入选项后可以避免这个问题。

$ sudo pip install cql -I six

※ pip 选项清单

3. 连接至Cassandra

开启Docker后进行连接。

$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
cqlsh>
广告
将在 10 秒后关闭
bannerAds