我的编程空间,编程开发者的网络收藏夹
学习永远不晚

安装apache-cassandra-2.1.18

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

安装apache-cassandra-2.1.18

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();

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

安装apache-cassandra-2.1.18

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

Apache安装

1、打开终端,查看Apache版本:httpd -v或sudo apachectl -vServer version: Apache/2.4.28 (Unix)Server built: Oct 9 2017 19:54:202、开启
2023-01-30

apache 怎么安装

要安装Apache,您可以按照以下步骤进行操作:1.检查系统依赖项:确保您的系统上已安装了所需的依赖项,包括GCC编译器、make工具和pcre库。可以通过运行以下命令来安装它们:- 对于Debian或Ubuntu系统:`sudo apt-
2023-09-05

Apache Tomcat怎么安装

本篇内容介绍了“Apache Tomcat怎么安装”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!Tomcat是哪种服务器?Java生态系统支
2023-06-27

apache如何安装ssl

本文详细介绍了在Apache中安装SSL的分步指南,包括生成私钥和证书签名请求、获取SSL证书、配置Apache、启用SSL模块、重启Apache和验证SSL安装。它还提供了有关HTTP/2支持、HSTS标头、重定向到HTTPS和常见问题的附加选项和信息。
apache如何安装ssl
2024-04-12

apache如何安装ssl

要在Apache服务器上安装SSL证书,可以按照以下步骤进行操作:1. 生成SSL证书请求(CSR):使用openssl命令生成CSR文件,包含您的域名和服务器信息。示例命令如下:```openssl req -new -newkey rs
2023-08-24

Cassandra简单介绍和二进制安装

Cassandra简介:Apache Cassandra最初由Facebook开发,用于储存收件箱等简单格式数据,集GoogleBigTable的数据模型与Amazon Dynamo的完全分布式的架构于一身Facebook于2008将 Cassandra 开源
Cassandra简单介绍和二进制安装
2021-09-21

linux中如何安装apache

小编给大家分享一下linux中如何安装apache,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!下载httpd-2.2.6.tar.bz2 把httpd-2.2.
2023-06-13

云服务器安装apache

如果您正在使用云计算平台提供的在线服务,比如AmazonWebServices(AWS)、GoogleCloudPlatform,IronwellHyper数据中心或DigitalMountainView等等,安装apache是一个简单的步骤。下面是一份简单的配置指南,您可以通过这些指南来配置和管理您的AWS、GoogleCloudPlatform、IronwellHyper数据中心和Digi
2023-10-26

Linux中怎么安装apache

这篇文章主要为大家分析了Linux中怎么安装apache的相关知识点,内容详细易懂,操作细节合理,具有一定参考价值。如果感兴趣的话,不妨跟着跟随小编一起来看看,下面跟着小编一起深入学习“Linux中怎么安装apache”的知识吧。
2023-06-28

​Cassandra安装及使用的方法是什么

Cassandra安装前提条件:Linux系统,Java8+,SSH权限步骤:创建cassandra用户下载和解压Cassandra设置环境变量配置cassandra.yaml和jvm.options启动和使用:启动Cassandra创建密钥空间和表插入和查询数据停止Cassandra监控Cassandra(nodetool)
​Cassandra安装及使用的方法是什么
2024-04-13

如何安装Ubuntu apache-2.1.11

小编给大家分享一下如何安装Ubuntu apache-2.1.11,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!安装Ubuntu apache-2.1.111、下
2023-06-16

apache安装教程详解

安装Apache的步骤如下:1. 下载Apache软件包:访问Apache官方网站并下载最新版本的Apache软件包。2. 解压软件包:将下载的软件包解压到任意目录。3. 配置Apache:进入解压后的Apache目录,找到"conf"文件
2023-09-21

编程热搜

目录