In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Introduction
What is Cassandra?
The Apache Cassandra database is the right choice when you need scalability (scalable) and high availability without compromising performance. Linear scalability and proven fault-tolerance (Fault tolerant system) 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 (Survival) regional outages.
Prerequisites
CentOS release 6.5 (Final)
System parameter configuration
[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
Change to:
* soft nproc 10240
[root@sht-sgmhadoopdn-02] # swapoff-a
Software preparation: 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
Create user groups and users
[root@sht-sgmhadoopdn-02 softwore] # groupadd appuser
[root@sht-sgmhadoopdn-02 softwore] # useradd-g appuser-G root-d / usr/local/cassandra tnuser
Install 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)
Install 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
Install 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
# add self-startup (you don't have to do this step)
[root@sht-sgmhadoopdn-02 local] # vim / etc/rc.local
Su-tnuser-c "cd / usr/local/cassandra/bin/ & & nohup. / cassandra"
Set environment variabl
[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)
Create related directories
[tnuser@sht-sgmhadoopdn-02 cassandra] $mkdir-p / usr/local/cassandra/ {data,commitlog,log,saved_caches}
Settings profile: 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: ","
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
Settings profile: logback.xml
[tnuser@sht-sgmhadoopdn-02 conf] $vim / usr/local/cassandra/conf/logback.xml
INFO
/ usr/local/cassandra/log/system.log
Start 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. 0. 0. 0. 0. 0. 0. 0. 9042 0. 0. 0. 0. 0. 0
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.JarGREGREX USERGREX LocalCassandraCassandraCassandraCassandRafel LZFICE 0.8.4.JarGunGetWord ("LZF"); "LZF"LZF" 16.0.JarVERGER Universe 1.0.6.JarVERUGER CassandraAfter libUBUT 1.9.2.jarRJUR Razor Lexus 1.9.2.jarJUR Razor CPART MAPPERRART 1.9.2.JarJUR RexorGear 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
Login mode
[tnuser@sht-sgmhadoopdn-02 cassandra] $cqlsh
Cqlsh >
Stop the cassandra service
# find the process number corresponding to cassandra first, and then kill
The pgrep command looks for a process by name from the running process queue and displays the process id found.
-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) an error was reported when starting cassand:
[tnuser@sht-sgmhadoopdn-02 cassandra] $cassandra
.
ERROR:java.lang.RuntimeException: Unable to gossip with any seeds
.
Solution:
Modify the configuration file
[tnuser@sht-sgmhadoopdn-02 cassandra] $vim / usr/local/cassandra/conf/cassandra.yaml
-seeds: "127.0.0.1" is changed to
-seeds: "172.16.101.59"
(2) an error was reported when logging in using cqlsh
Darren2:tnuser:/usr/local/cassandra: > cqlsh
Traceback (most recent call last):
File "/ usr/local/cassandra/bin/cqlsh.py", line 168, in
From cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, cqlshhandling
File "/ usr/local/cassandra/bin/../pylib/cqlshlib/sslhandling.py", line 20, in
Import ssl
File "/ usr/local/python/lib/python2.7/ssl.py", line 97, in
Import _ ssl # if we can't import it, let the error propagate
ImportError: No module named _ ssl
Reason: ssl module in python cannot be called properly
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 "", line 1, in
File "/ usr/local/python/lib/python2.7/ssl.py", line 97, in
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
Solution:
[root@Darren2 local] # yum install openssl-devel-y
Reinstall python
Darren2:tnuser:/usr/local/cassandra: > python
> import ssl
> import _ ssl
> > quit ()
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.