Home Database Mysql Tutorial 部署两节点cassandra集群

部署两节点cassandra集群

Jun 07, 2016 pm 05:41 PM
cassandra node deploy cluster

部署两节点cassandra集群确保系统已安装jdk,可不配置JAVA环境变量cassandra版本:apache-cassandra-1.1.5jdk版本:jdk1.6.0_381、cassandra日志路径#vimlog4j-s

部署两节点cassandra集群


确保系统已安装jdk,虚拟主机,可不配置JAVA环境变量


cassandra版本:apache-cassandra-1.1.5

jdk版本:jdk1.6.0_38


1、cassandra 日志路径

#vim log4j-server.properties

log4j.appender.R.File=/trs6/cassandra/logs/system.log


2、cassandra 内存使用 (HEAP_NEWSIZE)=1/4(MAX_HEAP_SIZE)

#vim cassandra-env.sh

MAX_HEAP_SIZE="4G"

HEAP_NEWSIZE="800M"


3、cassandra 集群配置

#vim cassandra.yaml

cluster_name: 'pis'    //集群名称

initial_token: 0    //由initial_token.py生成


#!/usr/bin/env python

import sys

if (len(sys.argv) > 1):

        num=int(sys.argv[1])

else:

        num=int(raw_input("How many nodes are in your cluster? "))

for i in range(0, num):

        print 'node %d: %d' % (i, (i*(2**127)/num))


data_file_directories:

    - /trs6/cassandra/data    //data存储目录

commitlog_directory: /trs6/cassandra/commitlog     //commit日志目录

saved_caches_directory: /trs6/cassandra/saved_cache  //cache存储目录

- seeds: "192.168.183.71,192.168.183.72"     //种子节点IP

listen_address: 192.168.183.71    //监听地址->本机IP

rpc_address: 192.168.183.71

endpoint_snitch: SimpleSnitch


4、启动集群

#bin/cassandra


5、查看集群状态

#bin/nodetool -h 192.168.183.71 ring


Address         DC          Rack        Status State   Load            Effective-Ownership Token                                       

                                                                                           85070591730234615865843651857942052864      

192.168.183.71  datacenter1 rack1       Up     Normal  23.61 KB        50.00%              0                                           

192.168.183.72  datacenter1 rack1       Up     Normal  23.61 KB        50.00%              85070591730234615865843651857942052864


6、交互式命令行 (分号结尾)

[root@cas1 ~]# bin/cassandra-cli -h 192.168.183.71

Connected to: "pis" on 192.168.183.71/9160

Welcome to Cassandra CLI version 1.1.5


Type 'help;' or '?' for help.

Type 'quit;' or 'exit;' to quit.


(1)创建keyspace

[default@unknown] create keyspace DEMO;

5210d4ac-24e2-37e1-8d38-13a3cab24f33

Waiting for schema agreement...

... schemas agree across the cluster

(2)认证使用keyspace

[default@unknown] use DEMO;

Authenticated to keyspace: DEMO

(3)创建column family

[default@DEMO] create column family Users                

...with key_validation_class = 'UTF8Type'    

...and comparator = 'UTF8Type'               

...and default_validation_class = 'UTF8Type';

8618bf72-4e3d-3b7c-84f6-031e69e7d161

Waiting for schema agreement...

... schemas agree across the cluster

(4)存储数据到column family

[default@DEMO] set Users[1234][name] = tianxin;

Value inserted.

Elapsed time: 87 msec(s).

[default@DEMO] set Users[1234][password] = upgirl; 

Value inserted.

Elapsed time: 28 msec(s).

(5)获取数据

[default@DEMO] get Users[1234];

=> (column=name, value=tianxin, timestamp=1362521480914000)

=> (column=password, value=upgirl, timestamp=1362521498155000)

Returned 2 results.

Elapsed time: 131 msec(s).



遇到的问题:

1、启动cassandra时,报错 Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: cas1: cas1

原因:集群节点必须配置主机名的解析



2、创建keyspace时,香港空间,报错 The schema has not settled in 10 seconds; further migrations are ill-advised until it does.

Versions are e71db6f5-eb85-3555-b851-1878497cf194:[198.216.27.72],eceb06f2-03a1-3bf8-a421-2528a053d7e6:[198.216.27.71]

原因:集群节点间时间不同步


本文出自 “振翅的小宇宙” 博客,请务必保留此出处

,香港虚拟主机
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
How to use Jenkins Pipeline to build a continuous packaging and deployment process for PHP programs? How to use Jenkins Pipeline to build a continuous packaging and deployment process for PHP programs? Jul 30, 2023 pm 07:41 PM

How to use JenkinsPipeline to build a continuous packaging and deployment process for PHP programs? Jenkins is a very popular continuous integration and deployment tool. It provides a wealth of plug-ins and functions to make the build and deployment process simple and efficient. JenkinsPipeline is the latest plug-in for Jenkins, which allows us to use a complete and extensible DSL (DomainSpecificLanguage) to define continuous integration and deployment.

How to deploy a trustworthy web interface on a Linux server? How to deploy a trustworthy web interface on a Linux server? Sep 09, 2023 pm 03:27 PM

How to deploy a trustworthy web interface on a Linux server? Introduction: In today's era of information explosion, Web applications have become one of the main ways for people to obtain information and communicate. In order to ensure user privacy and information reliability, we need to deploy a trustworthy Web interface on the Linux server. This article will introduce how to deploy a web interface in a Linux environment and provide relevant code examples. 1. Install and configure the Linux server. First, we need to prepare a Li

How to solve the problem of inaccessibility after Tomcat deploys war package How to solve the problem of inaccessibility after Tomcat deploys war package Jan 13, 2024 pm 12:07 PM

How to solve the problem that Tomcat cannot successfully access the war package after deploying it requires specific code examples. As a widely used Java Web server, Tomcat allows developers to package their own developed Web applications into war files for deployment. However, sometimes we may encounter the problem of being unable to successfully access the war package after deploying it. This may be caused by incorrect configuration or other reasons. In this article, we'll provide some concrete code examples that address this dilemma. 1. Check Tomcat service

Yolov10: Detailed explanation, deployment and application all in one place! Yolov10: Detailed explanation, deployment and application all in one place! Jun 07, 2024 pm 12:05 PM

1. Introduction Over the past few years, YOLOs have become the dominant paradigm in the field of real-time object detection due to its effective balance between computational cost and detection performance. Researchers have explored YOLO's architectural design, optimization goals, data expansion strategies, etc., and have made significant progress. At the same time, relying on non-maximum suppression (NMS) for post-processing hinders end-to-end deployment of YOLO and adversely affects inference latency. In YOLOs, the design of various components lacks comprehensive and thorough inspection, resulting in significant computational redundancy and limiting the capabilities of the model. It offers suboptimal efficiency, and relatively large potential for performance improvement. In this work, the goal is to further improve the performance efficiency boundary of YOLO from both post-processing and model architecture. to this end

How to deploy applications using Docker containerization in FastAPI How to deploy applications using Docker containerization in FastAPI Jul 28, 2023 pm 01:25 PM

How to use Docker containerization to deploy applications in FastAPI Introduction: Docker is a containerization technology that packages applications and their dependencies into an independent, portable container to achieve rapid deployment and expansion. FastAPI is a modern, high-performance web framework based on Python that provides a simple and fast API development experience. This article will introduce how to use Docker containerization to deploy applications in FastAPI and provide corresponding code examples.

Gunicorn Deployment Guide for Flask Applications Gunicorn Deployment Guide for Flask Applications Jan 17, 2024 am 08:13 AM

How to deploy Flask application using Gunicorn? Flask is a lightweight Python Web framework that is widely used to develop various types of Web applications. Gunicorn (GreenUnicorn) is a Python-based HTTP server used to run WSGI (WebServerGatewayInterface) applications. This article will introduce how to use Gunicorn to deploy Flask applications, with

Node completely evacuates from Proxmox VE and rejoins the cluster Node completely evacuates from Proxmox VE and rejoins the cluster Feb 21, 2024 pm 12:40 PM

Scenario description for nodes to completely evacuate from ProxmoxVE and rejoin the cluster. When a node in the ProxmoxVE cluster is damaged and cannot be repaired quickly, the faulty node needs to be kicked out of the cluster cleanly and the residual information must be cleaned up. Otherwise, new nodes using the IP address used by the faulty node will not be able to join the cluster normally; similarly, after the faulty node that has separated from the cluster is repaired, although it has nothing to do with the cluster, it will not be able to access the web management of this single node. In the background, information about other nodes in the original ProxmoxVE cluster will appear, which is very annoying. Evict nodes from the cluster. If ProxmoxVE is a Ceph hyper-converged cluster, you need to log in to any node in the cluster (except the node you want to delete) on the host system Debian, and run the command

Best practices and common problem solutions for deploying web projects on Tomcat Best practices and common problem solutions for deploying web projects on Tomcat Dec 29, 2023 am 08:21 AM

Best practices for deploying Web projects with Tomcat and solutions to common problems Introduction: Tomcat, as a lightweight Java application server, has been widely used in Web application development. This article will introduce the best practices and common problem solving methods for Tomcat deployment of web projects, and provide specific code examples to help readers better understand and apply. 1. Project directory structure planning Before deploying a Web project, we need to plan the directory structure of the project. Generally speaking, we can organize it in the following way

See all articles