LoginSignup
7
3

More than 3 years have passed since last update.

MacでCassandraをローカルに構築する

Last updated at Posted at 2019-05-22

概要

環境構築の備忘録。
Cassandra をローカルで動かしたかったので、そのための手順を残しておく。

手順

Cassandra 本体の準備

今回はDockerで動かしてみる

docker-compose.yml
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) をインストール

1. 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>
7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3