真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

部署cassandra集群

部署cassandra集群

一、環(huán)境準(zhǔn)備

1.1、下載二進(jìn)制源碼包

wget http://apache.mirrors.hoobly.com/cassandra/3.11.5/apache-cassandra-3.11.5-bin.tar.gz

成都創(chuàng)新互聯(lián)2013年開創(chuàng)至今,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都做網(wǎng)站、網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元新密做網(wǎng)站,已為上家服務(wù),為新密各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:028-86922220

1.2、節(jié)點(diǎn)準(zhǔn)備

# 準(zhǔn)備三臺(tái)節(jié)點(diǎn)
192.168.100.226
192.168.100.227
192.168.100.228

# ansible配置
# 因?yàn)槭菧y(cè)試環(huán)境,這里就直接配置密碼,不去麻煩的配置免密驗(yàn)證了。
[root@master ~]# cat /etc/ansible/hosts
[casd]
192.168.100.226 ansible_ssh_user='root' ansible_ssh_pass='test123'
192.168.100.227 ansible_ssh_user='root' ansible_ssh_pass='test123'
192.168.100.228 ansible_ssh_user='root' ansible_ssh_pass='test123'

1.3、創(chuàng)建cassandra用戶

# 創(chuàng)建用戶
ansible casd -m user -a "name=cassandra state=present"

# 修改密碼
ansible casd -m shell -a "echo cassandra | passwd --stdin cassandra"

# 將cassandra二進(jìn)制包拷貝到部署節(jié)點(diǎn)上。
ansible casd -m copy -a "src=apache-cassandra-3.11.5.tar.gz dest=/home/cassandra/apache-cassandra-3.11.5.tar.gz"

# 解壓源碼包
ansible casd -m shell -a "cd /home/cassandra/; tar -zxvf apache-cassandra-3.11.5.tar.gz"

1.4、java環(huán)境準(zhǔn)備

# 拷貝jdk至部署節(jié)點(diǎn)
ansible casd -m copy -a "src=java-1.8.0-amazon-corretto-devel-1.8.0_212.b04-2.x86_64.rpm dest=/root"

# 安裝jdk
ansible casd -m shell -a "yum install -y java-1.8.0-amazon-corretto-devel-1.8.0_212.b04-2.x86_64.rpm"

# 驗(yàn)證jdk
``` bash
[root@localhost ~]# java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment Corretto-8.212.04.2 (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM Corretto-8.212.04.2 (build 25.212-b04, mixed mode)

1.5、配置用戶環(huán)境變量

# 切換用戶
[root@localhost ~]# su - cassandra 
Last login: Fri Dec  6 04:27:53 EST 2019 on pts/1

# 配置環(huán)境變量
[cassandra@localhost ~]$ vi .bash_profile
export CASSANDRA_HOME=/home/cassandra/apache-cassandra-3.11.5
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
export PATH=$JAVA_HOME/bin:$CASSANDRA_HOME/bin:$PATH

# 加載環(huán)境變量
[cassandra@localhost ~]$ source .bash_profile

二、部署cassandra

2.1、配置文件

修改配置文件 /home/cassandra/apache-cassandra-3.11.5/conf/cassandra.yaml

cluster_name: 'test'
data_file_directories:
    - /home/cassandra/apache-cassandra-3.11.5/data
commitlog_directory: /home/cassandra/apache-cassandra-3.11.5/data/commitlog
saved_caches_directory: /home/cassandra/apache-cassandra-3.11.5/data/saved_caches
seed_provider:
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
          - seeds: "192.168.100.226"  # 因子
listen_address: 192.168.100.226       # 監(jiān)聽地址,不可以為127.0.0.1
start_rpc: true
rpc_address: 192.168.100.226          # rpc監(jiān)聽地址,不可以為127.0.0.1

2.2、各節(jié)點(diǎn)

各節(jié)點(diǎn)的 listen_addressrpc_address 需要按節(jié)點(diǎn)配置,且不能使用 localhost,因子 seeds 配置為第一個(gè)啟動(dòng)的節(jié)點(diǎn)。

First Node
--------------
seeds: "192.168.100.226"
listen_address: 192.168.100.226
rpc_address: 192.168.100.226

Second Node
---------------
seeds: "192.168.100.226"
listen_address: 192.168.100.227
rpc_address: 192.168.100.227

Third Node
---------------
seeds: "192.168.100.226"
listen_address: 192.168.100.228
rpc_address: 192.168.100.228

三、啟動(dòng)cassandra服務(wù)

3.1、啟動(dòng)服務(wù)

# 先啟動(dòng)226, 使用-f選項(xiàng)啟動(dòng)在前臺(tái)
/home/cassandra/apache-cassandra-3.11.5/bin/cassandra

# 再啟動(dòng)其余的節(jié)點(diǎn)
/home/cassandra/apache-cassandra-3.11.5/bin/cassandra
/home/cassandra/apache-cassandra-3.11.5/bin/cassandra

3.2、驗(yàn)證服務(wù)

使用 nodetool status 驗(yàn)證服務(wù)

[cassandra@localhost ~]$/home/cassandra/apache-cassandra-3.11.5/bin/nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address          Load       Tokens       Owns (effective)  Host ID                               Rack
UN  192.168.100.226  302.76 KiB  256          69.2%             723cb923-d19c-4dea-8124-c4503dab4d75  rack1
UN  192.168.100.227  295.05 KiB  256          66.3%             5bbeeb09-9bf4-4e45-a7a1-168e4f87186f  rack1
UN  192.168.100.228  239.96 KiB  256          64.5%             78677dd0-797e-45b0-a34a-23842927af35  rack1

分享名稱:部署cassandra集群
標(biāo)題來(lái)源:http://weahome.cn/article/gddhcg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部