zoukankan      html  css  js  c++  java
  • Cassandra V2.1.20单机安装

    1. 系统调优

    [root@sht-sgmhadoopcm-01 ~]# echo "vm.max_map_count=131072" >> /etc/sysctl.conf 
    [root@sht-sgmhadoopcm-01 ~]# echo "vm.swappiness = 1" >> /etc/sysctl.conf 
    [root@sht-sgmhadoopcm-01 ~]# sysctl -p
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandra  soft    memlock unlimited" >>  /etc/security/limits.conf
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandra  hard    memlock unlimited" >>  /etc/security/limits.conf
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandrasoft    nofile  65536" >>  /etc/security/limits.conf
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandrahard    nofile  65536" >>  /etc/security/limits.conf
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandrasoft    nproc  65536" >>  /etc/security/limits.conf
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandrahard    nproc  65536" >>  /etc/security/limits.conf
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandrasoft    as  unlimited" >>  /etc/security/limits.conf
    [root@sht-sgmhadoopcm-01 ~]# echo "cassandrahard    as  unlimited" >>  /etc/security/limits.conf

    2. 安装python2.7.*

    [root@sht-sgmhadoopcm-01 ~]# wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
    [root@sht-sgmhadoopcm-01 ~]# tar -zxf Python-2.7.15.tgz 
    [root@sht-sgmhadoopcm-01 ~]# cd Python-2.7.15
    [root@sht-sgmhadoopcm-01 Python-2.7.15]# ./configure --prefix=/usr/local/python-2.7.15
    [root@sht-sgmhadoopcm-01 Python-2.7.15]# make && make install
    [root@sht-sgmhadoopcm-01 Python-2.7.15]# /usr/local/python-2.7.15/bin/python -V
    Python 2.7.15

    3. 安装Java1.8.*

    [root@sht-sgmhadoopcm-01 ~]# wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
    [root@sht-sgmhadoopcm-01 ~]# tar -zxf jdk-8u171-linux-x64.tar.gz -C /usr/java
    [root@sht-sgmhadoopcm-01 ~]# /usr/java/jdk1.8.0_171/bin/java -version
    java version "1.8.0_171"
    Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
    Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

    4. 创建cassandra用户和组并设置相关环境变量

    [root@sht-sgmhadoopcm-01 ~]# groupadd -r dba -g 501
    [root@sht-sgmhadoopcm-01 ~]# useradd -r -u 501 -g dba cassandra -d /home/cassandra
    [root@sht-sgmhadoopcm-01 ~]# su - cassandra
    [cassandra@sht-sgmhadoopcm-01 ~]$ vim ~/.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.8.0_171
    export PYTHON_HOME=/usr/local/python-2.7.15
    export PATH=$PYTHON_HOME/bin:$JAVA_HOME/bin:$CASSANDRA_HOME/bin:$CASSANDRA_HOME/tools/bin:$PATH:$HOME/bin:/usr/local/bin

    5. 配置cassandra数据库

    [root@sht-sgmhadoopcm-01 ~]# wget http://archive.apache.org/dist/cassandra/2.1.20/apache-cassandra-2.1.20-bin.tar.gz
    [root@sht-sgmhadoopcm-01 ~]# tar -zxf apache-cassandra-2.1.20-bin.tar.gz -C /usr/local/
    [root@sht-sgmhadoopcm-01 ~]# cd /usr/local/
    [root@sht-sgmhadoopcm-01 local]# ln -s apache-cassandra-2.1.20 cassandra
    [root@sht-sgmhadoopcm-01 local]# chown -R cassandra.dba apache-cassandra-2.1.20/
    [root@sht-sgmhadoopcm-01 local]# echo 'su - cassandra -c "cd /usr/local/cassandra/bin/ && nohup ./cassandra "' >> /etc/rc.local
    [root@sht-sgmhadoopcm-01 local]# su - cassandra
    [cassandra@sht-sgmhadoopcm-01 ~]$ mkdir /usr/local/cassandra/{data,commitlog,saved_caches,logs}
    [cassandra@sht-sgmhadoopcm-01 ~]$ cat -n  /usr/local/cassandra/conf/cassandra.yaml
    …………………
        10    cluster_name: 'MyCluster'
       106    data_file_directories:
       107         - /usr/local/cassandra/data
       112    commitlog_directory: /usr/local/cassandra/commitlog
       227    saved_caches_directory: /usr/local/cassandra/saved_caches
       273              - seeds: "172.16.101.54"
       386    listen_address: 172.16.101.54
       401    start_native_transport: true
       424    start_rpc: true
       444    rpc_address: 0.0.0.0
       455    broadcast_rpc_address: 172.16.101.54
    
    …………………
    [cassandra@sht-sgmhadoopcm-01 ~]$ cat -n /usr/local/cassandra/conf/cassandra-env.sh
    …………………
       143    MAX_HEAP_SIZE="4G"
       144    HEAP_NEWSIZE="400M"
    …………………

     6. 启动cassandra

    [cassandra@sht-sgmhadoopcm-01 ~]$ /usr/local/cassandra/bin/cassandra
    ....................
    INFO  10:14:03 No gossip backlog; proceeding
    
    ....................
    [cassandra@sht-sgmhadoopcm-01 ~]$ cat /usr/local/cassandra/logs/system.log 
    .........................
    INFO  [main] 2018-05-19 18:14:04,195 Server.java:194 - Starting listening for CQL clients on /0.0.0.0:9042...
    INFO  [main] 2018-05-19 18:14:04,489 ThriftServer.java:119 - Binding thrift service to /0.0.0.0:9160
    INFO  [Thread-2] 2018-05-19 18:14:04,539 ThriftServer.java:136 - Listening for thrift clients...

     7. 登录cassandra数据库

    [cassandra@sht-sgmhadoopcm-01 ~]$ cqlsh 172.16.101.54 9042
    Connected to MyCluster at 172.16.101.54:9042.
    [cqlsh 5.0.1 | Cassandra 2.1.20 | CQL spec 3.2.1 | Native protocol v3]
    Use HELP for help.
    cqlsh>
    
    [cassandra@sht-sgmhadoopcm-01 ~]$ cassandra-cli --host 172.16.101.54 --port 9160
    Connected to: "MyCluster" on 172.16.101.54/9160
    Welcome to Cassandra CLI version 2.1.20
    
    The CLI is deprecated and will be removed in Cassandra 2.2.  Consider migrating to cqlsh.
    CQL is fully backwards compatible with Thrift data; see http://www.datastax.com/dev/blog/thrift-to-cql3
    
    Type 'help;' or '?' for help.
    Type 'quit;' or 'exit;' to quit.
    
    [default@unknown] 
  • 相关阅读:
    团队十日冲刺1
    第八周学习进度
    人月神话阅读笔记02
    课堂练习-顶会热词统计
    第七周学习进度
    《vim — vimrc的设置》
    《开发板 — 调试串口》
    《网络编程 — 127.0.0.1的作用》
    《网络编程 — INADDR_ANY的含义》
    《开发板 — 上查看串口信息》
  • 原文地址:https://www.cnblogs.com/ilifeilong/p/9055405.html
Copyright © 2011-2022 走看看