环境准备

JDK1.8 http://download.oracle.com/otn/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz

Python2.7* https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz

Cassandra 2.1.* http://archive.apache.org/dist/cassandra/2.1.20/apache-cassandra-2.1.20-bin.tar.gz

Host Name IP Address OS
sht-sgmhadoopcm-01 172.16.101.54 CentOS7.1
sht-sgmhadoopnn-01 172.16.101.55

CentOS7.1

sht-sgmhadoopnn-02 172.16.101.56

CentOS7.1

1. 各节点做准备工作

安装python和java

[root@sht-sgmhadoopcm- ~]# tar -zxf Python-2.7..tgz
[root@sht-sgmhadoopcm- ~]# cd Python-2.7.
[root@sht-sgmhadoopcm- Python-2.7.]# ./configure --prefix=/usr/local/python-2.7. --enable-optimizations
[root@sht-sgmhadoopcm- Python-2.7.]# make && make install
[root@sht-sgmhadoopcm- ~]# /usr/local/python-2.7./bin/python --version
Python 2.7. [root@sht-sgmhadoopcm- ~]# tar -zxf jdk-8u111-linux-x64.tar.gz -C /usr/java/
[root@sht-sgmhadoopcm- ~]# /usr/java/jdk1..0_111/bin/java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) -Bit Server VM (build 25.111-b14, mixed mode)

配置系统用户

[root@sht-sgmhadoopcm- ~]# groupadd -r -g  dba
[root@sht-sgmhadoopcm- ~]# useradd -r -u -d /home/cassandra -g dba -G root cassandra
[root@sht-sgmhadoopcm- ~]# cat /home/cassandra/.bash_profile
# .bash_profile # Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs export CASSANDRA_HOME=/usr/local/cassandra
export JAVA_HOME=/usr/java/jdk1..0_171
export PYTHON_HOME=/usr/local/python-2.7.
export PATH=$PYTHON_HOME/bin:$JAVA_HOME/bin:$CASSANDRA_HOME/bin:$CASSANDRA_HOME/tools/bin:$PATH:$HOME/bin:/usr/local/bin

安装Cassandra

[root@sht-sgmhadoopcm- ~]# tar -zxf apache-cassandra-2.1.-bin.tar.gz -C /usr/local/
[root@sht-sgmhadoopcm- ~]# ln -s /usr/local/apache-cassandra-2.1. /usr/local/cassandra
[root@sht-sgmhadoopcm- ~]# chown -R cassandra.dba /usr/local/apache-cassandra-2.1./

2. 配置cassandra

cassandra-topology.properties文件各节点一致

[cassandra@sht-sgmhadoopcm-01 conf]$ cat cassandra-topology.properties
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License. # Cassandra Node IP=Data Center:Rack
#192.168.1.100=DC1:RAC1
#192.168.2.200=DC2:RAC2 #10.0.0.10=DC1:RAC1
#10.0.0.11=DC1:RAC1
#10.0.0.12=DC1:RAC2 #10.20.114.10=DC2:RAC1
#10.20.114.11=DC2:RAC1 #10.21.119.13=DC3:RAC1
#10.21.119.10=DC3:RAC1 #10.0.0.13=DC1:RAC2
#10.21.119.14=DC3:RAC2
#10.20.114.15=DC2:RAC2
172.16.101.54=EAST:RAC1
172.16.101.55=EAST:RAC1
172.16.101.56=EAST:RAC1 # default for unknown nodes
default=DC1:r1 # Native IPv6 is supported, however you must escape the colon in the IPv6 Address
# Also be sure to comment out JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
# in cassandra-env.sh
fe80\:0\:0\:0\:202\:b3ff\:fe1e\:8329=DC1:RAC3

cassandra.yaml

cluster_name: 'NavigationData'
data_file_directories:
- /usr/local/cassandra/data
commitlog_directory: /usr/local/cassandra/commitlog

saved_caches_directory: /usr/local/cassandra/saved_caches
seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "172.16.101.54,172.16.101.55"
listen_address: 172.16.101.54 #修改为各节点的IP地址
rpc_address: 172.16.101.54 #修改为各节点的IP地址
endpoint_snitch: PropertyFileSnitch

cassandra-env.sh注释如下

#if [ "x$LOCAL_JMX" = "x" ]; then
# LOCAL_JMX=yes
#fi

3.启动并查看cassandra

[cassandra@sht-sgmhadoopcm- ~]$ /usr/local/cassandra/bin/cassandra &
[cassandra@sht-sgmhadoopnn- ~]$ /usr/local/cassandra/bin/cassandra &
[cassandra@sht-sgmhadoopnn- ~]$ /usr/local/cassandra/bin/cassandra & [cassandra@sht-sgmhadoopcm- ~]$ nodetool status
Datacenter: EAST
================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 172.16.101.54 51.75 KB 64.5% 0ec471a6--4c53-9b70-78b03b40d13b RAC1
UN 172.16.101.55 118.25 KB 69.2% d4c873d0-e3b8-4e73-a9eb-1e238a399183 RAC1
UN 172.16.101.56 162.38 KB 66.4% 6f7b0f6e-f4bc--b431-dddbeb16dcc1 RAC1

Cassandra集群:一,搭建一个三节点的集群的更多相关文章

  1. 项目进阶 之 集群环境搭建(三)多管理节点MySQL集群

    上次的博文项目进阶 之 集群环境搭建(二)MySQL集群中,我们搭建了一个基础的MySQL集群,这篇博客咱们继续讲解MySQL集群的相关内容,同时针对上一篇遗留的问题提出一个解决方案. 1.单管理节点 ...

  2. 理解 OpenStack Swift (1):OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置

    本系列文章着重学习和研究OpenStack Swift,包括环境搭建.原理.架构.监控和性能等. (1)OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置 ( ...

  3. 11. 搭建一个完整的K8S集群

    11. 搭建一个完整的Kubernetes集群 1. kubectl的命令遵循分类的原则(重点) 语法1: kubectl 动作 类 具体的对象 例如: """ kube ...

  4. rancher三节点k8s集群部署例子

    rancher三节点k8s集群部署例子 待办 https://rorschachchan.github.io/2019/07/25/使用Rancher2-1部署k8s/

  5. Kubernetes — 从0到1:搭建一个完整的Kubernetes集群

    准备工作 首先,准备机器.最直接的办法,自然是到公有云上申请几个虚拟机.当然,如果条件允许的话,拿几台本地的物理服务器来组集群是最好不过了.这些机器只要满足如下几个条件即可: 满足安装 Docker ...

  6. etcd三节点安全集群搭建-pki安全认证

    etcd安全集群搭建就是 pki安装认证 1.环境: 三台centos7. 主机 192.168.0.91 192.168.0.92 192.168.0.93 都关闭防火墙 都关闭selinux 配置 ...

  7. 部署elasticsearch(三节点)集群+filebeat+kibana

    用途 ▷ 通过各个beat实时收集日志.传输至elasticsearch集群 ▷ 通过kibana展示日志 实验架构 名称:IP地址:CPU:内存 kibana&cerebro:192.168 ...

  8. 仅需60秒,使用k3s创建一个多节点K8S集群!

    作者: Dawid Ziolkowski丨Container Solution云原生工程师 最近,我一直在Kubernetes上进行各种测试和部署.因此,我不得不一次又一次创建和销毁Kubernete ...

  9. 搭建一个完整的K8S集群-------基于CentOS 8系统

    创建三个centos节点: 192.168.5.141 k8s-master 192.168.5.142 k8s-nnode1 192.168.5.143 k8s-nnode2 查看centos系统版 ...

随机推荐

  1. linux 防火墙 iptables 目录

    linux iptables 防火墙简介 Linux 防火墙:Netfilter iptables 自动化部署iptables防火墙脚本

  2. django中的数据库迁移

    Django是用python写的web开发框架,其特点是: 1.重量级框架,内部封装了很多的功能组件,使开发变的简便快速, 2.MVT模式:前后端分离,高内聚低耦合,m:model,与mvc中的m功能 ...

  3. CentOS 7 NAT模式LVS搭建

    NAT模式下 , 调度器需要有两个IP , 一个公网IP一个内网IP , web服务器只需要内网IP 调度器LB : 192.168.94.11(内网IP)  192.168.29.11 (仅主机模式 ...

  4. 自定义Word颜色主题

    外观 说明 看到这个黑色编辑器的界面,第一印象可能认为是Sublime.Atom. VScode或者其它markdown编辑器.其实仅仅是微软的Word经过了自定义主题. 选择清晰易于辨认的字体和深色 ...

  5. apache+jk+tomcat+ssl的https改造

    项目背景 公司项目要进行https的改造,目前在测试环境搭建了一下,参考了网上的例子(http://blog.csdn.net/whumr1/article/details/7804992) 这里把主 ...

  6. sed 正则的一个小问题

    有一段类似以下的文本 aabbccc test[3307]112323553-66778tp aooppx69tp ooppsg aabbccc test[3307]1127233-6674tp bo ...

  7. [C++ Primer Plus] 零散知识点(一)、输入函数(cin,cin.get,cin.getline等)+string头文件辨析

    本文几乎照搬http://www.cnblogs.com/luolizhi/p/5746775.html博客,只修改了一点点.不知道怎么转发过来,尴尬... 学C++的时候,这几个输入函数弄的有点迷糊 ...

  8. java中什么是泛型

    一. 泛型概念的提出(为什么需要泛型)? 首先,我们看下下面这段简短的代码: 1 public class GenericTest { 2 3 public static void main(Stri ...

  9. git分散式版本管理系统,从安装到基本使用

    首先,当然是安装git了,不用寻思,官网下载即可 https://git-scm.com/downloads 第二是设置账户,鼠标右键,选择git bush,在命令窗口中进行设置 git config ...

  10. Ansible 的安装

    On Fedora: $ sudo dnf install ansible On RHEL and CentOS: $ sudo yum install ansible On Ubuntu: $ su ...