返回顶部
首页 > 资讯 > 数据库 >安装apache-cassandra-2.1.18
  • 792
分享到

安装apache-cassandra-2.1.18

2024-04-02 19:04:59 792人浏览 薄情痞子
摘要

IntroductionWhat is Cassandra? The Apache Cassandra database is the right choice when you need Sca

Introduction

What is Cassandra? 

The Apache Cassandra database is the right choice when you need Scalability(伸缩) and high availability without compromising perfORMance. Linear scalability and proven fault-tolerance(容错系统)on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data.Cassandra's support for replicating across multiple datacenters is best-in-class, providing lower latency for your users and the peace of mind of knowing that you can survive(生存) regional outages.


Prerequisites

Centos release 6.5 (Final)


系统参数配置

[root@sht-sgmhadoopdn-02 ~]# vim /etc/security/limits.conf

tnuser soft memlock unlimited

tnuser hard memlock unlimited


[root@sht-sgmhadoopdn-02 ~]# sysctl -w vm.max_map_count=131072

[root@sht-sgmhadoopdn-02 ~]# echo "vm.max_map_count=131072" >> /etc/sysctl.conf

[root@sht-sgmhadoopdn-02 ~]#vim /etc/security/limits.d/90-nproc.conf

*          soft    nproc     1024

改为:

*          soft    nproc     10240


[root@sht-sgmhadoopdn-02 ~]# swapoff -a


软件准备:cassandra,jdk,python

[root@sht-sgmhadoopdn-02 softwore]# ll

total 218276

-rw-r--r-- 1 dhchen Corp_User  25288340 Aug 14 14:44 apache-cassandra-2.1.18-bin.tar.gz

-rw-r--r-- 1 dhchen Corp_User 181442359 Aug 14 14:43 jdk-8u111-linux-x64.tar.gz

-rw-r--r-- 1 dhchen Corp_User  16768806 Aug 14 14:44 Python-2.7.10.tgz


创建用户组和用户

[root@sht-sgmhadoopdn-02 softwore]# groupadd appuser

[root@sht-sgmhadoopdn-02 softwore]#useradd  -g appuser -G root -d /usr/local/cassandra tnuser


安装JAVA

[root@sht-sgmhadoopdn-02 softwore]# tar xf jdk-8u111-linux-x64.tar.gz -C /usr/local/

[root@sht-sgmhadoopdn-02 local]# ln -s /usr/local/jdk1.8.0_111 /usr/local/java

[root@sht-sgmhadoopdn-02 local]# chown -R tnuser:appuser /usr/local/java

[root@sht-sgmhadoopdn-02 local]# /usr/local/java/bin/java -version

java version "1.8.0_111"

Java(TM) SE Runtime Environment (build 1.8.0_111-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)


安装python

[root@sht-sgmhadoopdn-02 local]# tar xf Python-2.7.10.tgz -C /usr/local

[root@sht-sgmhadoopdn-02 local]# cd Python-2.7.10

[root@sht-sgmhadoopdn-02 Python-2.7.10]# ./configure --prefix=/usr/local/python

[root@sht-sgmhadoopdn-02 Python-2.7.10]#make && make install

[root@sht-sgmhadoopdn-02 local]# chown -R tnuser:appuser /usr/local/python

[root@sht-sgmhadoopdn-02 local]# /usr/local/python/bin/python --version

Python 2.7.10



安装cassandra

[root@sht-sgmhadoopdn-02 local]# tar xf /opt/softwore/apache-cassandra-2.1.18-bin.tar.gz -C /usr/local/

[root@sht-sgmhadoopdn-02 local]# ln -s /usr/local/apache-cassandra-2.1.18 /usr/local/cassandra

[root@sht-sgmhadoopdn-02 local]# chown -R tnuser:appuser /usr/local/apache-cassandra-2.1.18

[root@sht-sgmhadoopdn-02 local]# chown -R tnuser:appuser /usr/local/cassandra


#加入自启动(可以不做这一步)

[root@sht-sgmhadoopdn-02 local]# vim /etc/rc.local

su - tnuser -c "cd /usr/local/cassandra/bin/ && nohup ./cassandra "



设置环境变量

[root@sht-sgmhadoopdn-02 local]# su - tnuser

[tnuser@sht-sgmhadoopdn-02 ~]$ cat ~/.bash_profile

export CASSANDRA_HOME=/usr/local/cassandra

export JAVA_HOME=/usr/local/java

export PYTHON_HOME=/usr/local/python

PATH=$PYTHON_HOME/bin:$JAVA_HOME/bin:$CASSANDRA_HOME/bin:$CASSANDRA_HOME/tools/bin:$PATH:$HOME/bin:/usr/local/bin

export PATH

set umask to 022

umask 022

PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1



[tnuser@sht-sgmhadoopdn-02 ~]$ source .bash_profile

[tnuser@sht-sgmhadoopdn-02 ~]$ python -V

Python 2.7.10

[tnuser@sht-sgmhadoopdn-02 ~]$ java -version

java version "1.8.0_111"

Java(TM) SE Runtime Environment (build 1.8.0_111-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)


创建相关目录

[tnuser@sht-sgmhadoopdn-02 cassandra]$ mkdir -p /usr/local/cassandra/{data,commitlog,log,saved_caches}


设置配置文件:cassadnra.yaml

[tnuser@sht-sgmhadoopdn-02 conf]$ vim /usr/local/cassandra/conf/cassandra.yaml

cluster_name: 'mycluster'

data_file_directories:

      - /usr/local/cassandra/data

  commitlog_directory: /usr/local/cassandra/commitlog

 saved_caches_directory: /usr/local/cassandra/saved_caches

           - seeds: "172.16.101.59"

               # Ex: "<ip1>,<ip2>,<ip3>"

listen_address: 172.16.101.59

native_transport_port: 9042

start_rpc: true

rpc_address: 0.0.0.0

rpc_port: 9160

broadcast_rpc_address: 172.16.101.59


设置配置文件: logback.xml

[tnuser@sht-sgmhadoopdn-02 conf]$ vim /usr/local/cassandra/conf/logback.xml

    <level>INFO</level>

    </filter>

    <file>/usr/local/cassandra/log/system.log</file>


        

启动cassandra

[tnuser@sht-sgmhadoopdn-02 cassandra]$cassandra    

[tnuser@sht-sgmhadoopdn-02 cassandra]$ netstat -nltup |grep -e 9042 -e 9160

tcp        0      0 0.0.0.0:9042                0.0.0.0:*                   LISTEN      24286/java          

tcp        0      0 0.0.0.0:9160                0.0.0.0:*                   LISTEN      24286/java



[tnuser@sht-sgmhadoopdn-02 cassandra]$ lsof -Pnl|grep -e 9042 -e 9160

java      24286      503   72u     IPv4           35165833      0t0        TCP *:9042 (LISTEN)

java      24286      503   73u     IPv4           35165834      0t0        TCP *:9160 (LISTEN)


[tnuser@sht-sgmhadoopdn-02 ~]$ ps -ef |grep cassandra

tnuser   24286     1  2 18:00 pts/4    00:00:29 /usr/local/java/bin/java -ea -javaagent:/usr/local/cassandra/lib/jamm-0.3.0.jar -XX:+CMSClassUnloadingEnabled -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms1463M -Xmx1463M -Xmn200M -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:StringTableSize=1000003 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatinGoccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseTLAB -XX:CompileCommandFile=/usr/local/cassandra/conf/hotspot_compiler -XX:CMSWaitDuration=10000 -XX:+CMSParallelInitialMarkEnabled -XX:+CMSEdenChunksRecordAlways -XX:CMSWaitDuration=10000 -XX:+UseCondCardMark -Djava.net.preferIPv4Stack=true -Dcassandra.jmx.local.port=7199 -XX:+DisableExplicitGC -Dlogback.configurationFile=logback.xml -Dcassandra.logdir=/usr/local/cassandra/logs -Dcassandra.storagedir=/usr/local/cassandra/data -cp /usr/local/cassandra/conf:/usr/local/cassandra/build/classes/main:/usr/local/cassandra/build/classes/thrift:/usr/local/cassandra/lib/airline-0.6.jar:/usr/local/cassandra/lib/antlr-runtime-3.5.2.jar:/usr/local/cassandra/lib/apache-cassandra-2.1.18.jar:/usr/local/cassandra/lib/apache-cassandra-clientutil-2.1.18.jar:/usr/local/cassandra/lib/apache-cassandra-thrift-2.1.18.jar:/usr/local/cassandra/lib/commons-cli-1.1.jar:/usr/local/cassandra/lib/commons-codec-1.2.jar:/usr/local/cassandra/lib/commons-lang3-3.1.jar:/usr/local/cassandra/lib/commons-math4-3.2.jar:/usr/local/cassandra/lib/compress-lzf-0.8.4.jar:/usr/local/cassandra/lib/concurrentlinkedHashMap-lru-1.4.jar:/usr/local/cassandra/lib/disruptor-3.0.1.jar:/usr/local/cassandra/lib/guava-16.0.jar:/usr/local/cassandra/lib/high-scale-lib-1.0.6.jar:/usr/local/cassandra/lib/jackson-core-asl-1.9.2.jar:/usr/local/cassandra/lib/jackson-mapper-asl-1.9.2.jar:/usr/local/cassandra/lib/jamm-0.3.0.jar:/usr/local/cassandra/lib/javax.inject.jar:/usr/local/cassandra/lib/jbcrypt-0.3m.jar:/usr/local/cassandra/lib/jline-1.0.jar:/usr/local/cassandra/lib/jna-4.0.0.jar:/usr/local/cassandra/lib/JSON-simple-1.1.jar:/usr/local/cassandra/lib/libthrift-0.9.2.jar:/usr/local/cassandra/lib/logback-classic-1.1.2.jar:/usr/local/cassandra/lib/logback-core-1.1.2.jar:/usr/local/cassandra/lib/lz4-1.2.0.jar:/usr/local/cassandra/lib/metrics-core-2.2.0.jar:/usr/local/cassandra/lib/Netty-all-4.0.44.Final.jar:/usr/local/cassandra/lib/reporter-config-2.1.0.jar:/usr/local/cassandra/lib/slf4j-api-1.7.2.jar:/usr/local/cassandra/lib/snakeyaml-1.11.jar:/usr/local/cassandra/lib/snappy-java-1.0.5.2.jar:/usr/local/cassandra/lib/ST4-4.0.8.jar:/usr/local/cassandra/lib/stream-2.5.2.jar:/usr/local/cassandra/lib/super-csv-2.1.0.jar:/usr/local/cassandra/lib/thrift-server-0.3.7.jar org.apache.cassandra.service.CassandraDaemon



登录方式

[tnuser@sht-sgmhadoopdn-02 cassandra]$ cqlsh

cqlsh>



停止cassandra服务

#先找到cassandra对应的进程号,然后kill

pgrep命令以名称为依据从运行进程队列中查找进程,并显示查找到的进程id。

       -u    Only match processes whose real user ID is listed.  Either the numerical or symbolical value may be used.

       -f     The pattern is normally only matched against the process name.  When -f is set, the full command line is used.

[tnuser@sht-sgmhadoopdn-02 ~]$ pgrep -l -u tnuser

24286 java

25586 bash

[tnuser@sht-sgmhadoopdn-02 ~]$ pgrep -u tnuser -f cassandra

24286

[tnuser@sht-sgmhadoopdn-02 ~]$ pgrep -u tnuser -f cassandra|xargs kill -9



Error

(1)在启动cassand时候报错:

[tnuser@sht-sgmhadoopdn-02 cassandra]$ cassandra

.......

ERROR:java.lang.RuntimeException: Unable to gossip with any seeds

.......


Solution:

修改配置文件

[tnuser@sht-sgmhadoopdn-02 cassandra]$ vim /usr/local/cassandra/conf/cassandra.yaml

- seeds: "127.0.0.1" 改为

- seeds: "172.16.101.59"


(2)在使用cqlsh登录的时候报错

Darren2:tnuser:/usr/local/cassandra:>cqlsh

Traceback (most recent call last):

  File "/usr/local/cassandra/bin/cqlsh.py", line 168, in <module>

    from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, cqlshhandling

  File "/usr/local/cassandra/bin/../pylib/cqlshlib/sslhandling.py", line 20, in <module>

    import ssl

  File "/usr/local/python/lib/python2.7/ssl.py", line 97, in <module>

    import _ssl             # if we can't import it, let the error propagate

ImportError: No module named _ssl


原因:python中ssl模块无法正常调用

Darren2:tnuser:/usr/local:>python

Python 2.7.10 (default, Oct 18 2017, 21:17:45)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import ssl

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/python/lib/python2.7/ssl.py", line 97, in <module>

    import _ssl             # if we can't import it, let the error propagate


[root@Darren2 local]# yum list installed | grep ssl

openssl.x86_64          1.0.1e-15.el6   @anaconda-CentOS-201311272149.x86_64/6.5

openssl098e.x86_64      0.9.8e-17.el6.centos.2


解决方法:

[root@Darren2 local]#yum install openssl-devel -y

重新安装python;

Darren2:tnuser:/usr/local/cassandra:>python

>>> import ssl;

>>> import _ssl

>>> quit();

您可能感兴趣的文档:

--结束END--

本文标题: 安装apache-cassandra-2.1.18

本文链接: https://lsjlt.com/news/44159.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • 安装apache-cassandra-2.1.18
    IntroductionWhat is Cassandra The Apache Cassandra database is the right choice when you need scal...
    99+
    2024-04-02
  • 什么是Apache Cassandra
    Apache Cassandra是一个开源的分布式数据库系统,最初由Facebook开发并开源。它被设计成高度可扩展、高性能、高可用...
    99+
    2024-03-06
    Cassandra
  • Apache安装
    1、打开终端,查看Apache版本: httpd -v 或 sudo apachectl -v Server version: Apache/2.4.28 (Unix) Server built: Oct 9 2017 19:54...
    99+
    2023-01-30
    Apache
  • apache编译安装
    下载[root@localhost mysql]# cd /usr/local/src/[root@localhost src]# wget http://syslab.comsenz.com/downlo...
    99+
    2024-04-02
  • Ubuntu安装Apache+Php
    环境:ubuntu 22.04 虚拟机 首先更新一下 sudo apt-get updatesudo apt-get upgrade  安装Apache2: sudo apt-get install apache2 输入y,继续。等着他恐...
    99+
    2023-09-02
    ubuntu php linux
  • apache 怎么安装
    要安装Apache,您可以按照以下步骤进行操作:1.检查系统依赖项:确保您的系统上已安装了所需的依赖项,包括GCC编译器、make工...
    99+
    2023-09-05
    apache
  • 安装Apache mysql php
    目录 一.Apache网站服务 Apache——》静态页面处理——》将静态处理交给PHP Apache简介 安装Apache服务 ​编辑 安装软件思路  二.安装mysql数据库 1. 安装依赖包  2.创建程序用户管理  3.加压安装包...
    99+
    2023-09-04
    apache
  • Apache Tomcat怎么安装
    本篇内容介绍了“Apache Tomcat怎么安装”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!Tomcat是哪种服务器Java生态系统支持...
    99+
    2023-06-27
  • centos安装apache php mysql
    CentOS是一种免费的开源操作系统,被广泛用于服务器领域。作为一名服务器管理员,你可能会遇到需要安装Apache、PHP和MySQL等组件的情况,本文将向你展示如何在CentOS上安装这些组件。Apache安装Apache是一种流行的We...
    99+
    2023-05-24
  • centos安装apache php5.2.0 mysql
    CentOS是一种免费开源操作系统,常用于服务器环境。在服务器环境中,常常需要安装Apache、PHP和MySQL等开源软件,用于构建Web服务器和数据库服务器。在本文中,我们将介绍如何在CentOS中安装Apache、PHP 5.2.0和...
    99+
    2023-05-24
  • apache如何安装ssl
    要在Apache服务器上安装SSL证书,可以按照以下步骤进行操作:1. 生成SSL证书请求(CSR):使用openssl命令生成CS...
    99+
    2023-08-24
    apache ssl
  • Apache Cassandra 中的集合数据类型
    Apache Cassandra 中的集合数据类型包括:1. 列表(List):有序的元素集合,可以包含重复的元素。2. 集合(Se...
    99+
    2023-10-12
    Apache
  • Cassandra简单介绍和二进制安装
    Cassandra简介: Apache Cassandra最初由Facebook开发,用于储存收件箱等简单格式数据,集GoogleBigTable的数据模型与Amazon Dynamo的完全分布式的架构于一身Facebook于2...
    99+
    2021-09-21
    Cassandra简单介绍和二进制安装
  • Apache,PHP安装及Apache引入PHP模块
    一、下载Apache apache官网地址:https://httpd.apache.org/ 二、下载PHP php官网地址:https://www.php.net/ 三、安装 因为我们...
    99+
    2023-09-11
    php apache 服务器
  • 安装和使用apache geode
    最近在研究开源内存数据库,apache ignite用了一段时间感觉还行因为资料太少,因此只是用了它的rpc功能做了一个分布式框架。前天发现apache geode这个框架,据说是12306的Gemfire...
    99+
    2024-04-02
  • linux中如何安装apache
    小编给大家分享一下linux中如何安装apache,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!下载httpd-2.2.6.tar.bz2 把httpd-2.2....
    99+
    2023-06-13
  • 如何安装Ubuntu apache-2.1.11
    小编给大家分享一下如何安装Ubuntu apache-2.1.11,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!安装Ubuntu apache-2.1.11下载h...
    99+
    2023-06-16
  • apache安装教程详解
    安装Apache的步骤如下:1. 下载Apache软件包:访问Apache官方网站并下载最新版本的Apache软件包。2. 解压软件...
    99+
    2023-09-21
    Apache
  • Apache的下载与安装
    目录 一、下载 二、解压与安装 三、验证安装 四、常见问题​​​​​​​         由于apache是外网的东西,不稳定,有时候难访问与下载。所以给大家提供一个2.4.54_x64-vs17.zip 链接:https://pan....
    99+
    2023-10-05
    apache php 开发语言
  • Linux中怎么安装apache
    这篇文章主要为大家分析了Linux中怎么安装apache的相关知识点,内容详细易懂,操作细节合理,具有一定参考价值。如果感兴趣的话,不妨跟着跟随小编一起来看看,下面跟着小编一起深入学习“Linux中怎么安装apache”的知识吧。 ...
    99+
    2023-06-28
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作