cassandra安装

Posted perfei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cassandra安装相关的知识,希望对你有一定的参考价值。

 

单节点安装

cassandra由Java开发,需要提前配置JDK环境

 

开源版本安装

=======================================================

下载地址

http://archive.apache.org/dist/cassandra/

 

wget http://archive.apache.org/dist/cassandra/3.11.6/apache-cassandra-3.11.6-bin.tar.gz

wget  http://archive.apache.org/dist/cassandra/3.11.6/apache-cassandra-3.11.6-src.tar.gz

wget http://mirrors.tuna.tsinghua.edu.cn/apache/cassandra/2.1.21/apache-cassandra-2.1.21-bin.tar.gz

vim conf/cassandra-env.sh

MAX_HEAP_SIZE="4G"

HEAP_NEWSIZE="800M"

 

vim conf/cassandra.yaml

authenticator: PasswordAuthenticator

 

useradd cassandra

chown -R cassandra.cassandra /opt/app/apache-cassandra-2.1.21/

 

pkill -f CassandraDaemon

su - cassandra -c /opt/app/apache-cassandra-2.1.21/bin/cassandra

# netstat -tunlp |grep 9042
tcp        0      0 127.0.0.1:9042          0.0.0.0:*               LISTEN      6724/java 

 

 cd /opt/app/apache-cassandra-2.1.21

./bin/cqlsh -u cassandra -p cassandra localhost

CREATE USER automng WITH PASSWORD ‘Automng_123‘ SUPERUSER ;

./bin/cqlsh -u automng -p Automng_123 127.0.0.1

这里使用的是公有云,首先要开放其9042端口,然后修改几个IP地址,修改为内网IP即可,不需要填写公网IP

# cat conf/cassandra.yaml |grep 172
          - seeds: "172.21.0.12"
listen_address: 172.21.0.12
rpc_address: 172.21.0.12

然后重启cassandra

pkill -f CassandraDaemon

su - cassandra -c /opt/app/apache-cassandra-2.1.21/bin/cassandra

 

3.11.6安装记录

tar -xvf apache-cassandra-3.11.6-bin.tar.gz -C /opt/app/

chown -R cassandra.cassandra /opt/app/apache-cassandra-3.11.6/

修改Java堆内存与密码认证方式后,然后启动

su - cassandra -c /opt/app/apache-cassandra-3.11.6/bin/cassandra

./bin/cqlsh -u cassandra -p cassandra localhost

 

su: warning: cannot change directory to /home/cassandra: No such file or directory

root@db:~# mkdir /home/cassandra
root@db:~# chown -R  cassandra.cassandra /home/cassandra/
root@db:~# chmod -R 755 /home/cassandra/

 

企业版安装

================================================================

附·官方个人电脑安装指导

Your Own Computer 
This option is provided for users that really prefer to run exercises outside 
of a virtual machine or cloud instance. 
However due to the variety of different computing environments, no other 
support is provided outside of this document. We recommend using one of 
the other exercise environment options instead to avoid setup issues.
Prerequisite Software Java
8 – OpenJDK 8 or Oracle Java SE 8 (1.8.0_151 minimum) Python 2.7.x – https://www.python.org/downloads/ DataStax Python driver – https://github.com/datastax/python-driver

Requirements CPU – Multi-core 64-bit CPU Disk Size – 10GB free space Memory – 6GB or more Operating System – Mac OSX / Linux
Instructions
1. Download the DataStax Enterprise 6.0 tarball, available from the DataStax website. 2. Download DS201: Data Files and Scripts from the DS201 Course Assets page and extract the resulting zip file. 3. The extracted files include a script, labwork/config_node, which assumes that you will be installing DSE in the location /home/ubuntu. Edit the script to match the location you will be doing the exercises from. 4. Open a terminal window to start the DS201 exercises

 

 

Installing DataStax Enterprise 6.8 on Debian-based systems using APT

 官方安装指南-ubantu版

java -version
sudo apt-get install libaio1

curl -L https://downloads.datastax.com/enterprise/dse.tar.gz | tar xz
curl -L https://downloads.datastax.com/enterprise/dse-version_number-bin.tar.gz | tar xz
curl -L https://downloads.datastax.com/enterprise/dse-6.8.1-bin.tar.gz | tar xz

tar -xzvf dse-6.8.1-bin.tar.gz

In the installation_location, make the directories for data and logging directories. For example

mkdir dse-data &&
  cd dse-data && 
  mkdir data &&
  mkdir commitlog && 
  mkdir saved_caches &&
  mkdir hints && 
  mkdir cdc_raw



cd installation_location/resources/cassandra/conf

Update the following lines in the cassandra.yaml file
data_file_directories: 
  - full_path_to_installation_location/dse-data/data
  commitlog_directory: full_path_to_installation_location/dse-data/commitlog
  saved_caches_directory: full_path_to_installation_location/dse-data/saved_caches
  hints_directory: full_path_to_installation_location/dse-data/hints
  cdc_raw_directory: full_path_to_installation_location/cdc_raw

注意事项

For production, be sure to change the cassandra user. 这里有创建用户的说明。

 

以上是关于cassandra安装的主要内容,如果未能解决你的问题,请参考以下文章

Cassandra -- Cassandra 3.0版本安装

Cassandra在Windows上安装及使用方法

安装 cassandra 时出错

Cassandra安装及其简单试用

cassandra安装

Cassandra入门指南--安装及配置