如何在 Windows 7 64 位上创建本地多节点 Cassandra 集群? [英] How can I create a local multi-node Cassandra cluster on Windows 7 64 bit?

查看:21
本文介绍了如何在 Windows 7 64 位上创建本地多节点 Cassandra 集群?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一组指令来创建本地多节点

C:Usersmyusername>ccm node1 显示节点 1:向上集群=mytestclusterauto_bootstrap=假节俭=('127.0.0.1',9160)二进制=('127.0.0.1',9042)存储=('127.0.0.1',7000)jmx_port=7100remote_debug_port=0initial_token=-9223372036854775808pid=17432C:Usersmyusername>ccm node2 显示节点2:向上集群=mytestclusterauto_bootstrap=假节俭=('127.0.0.2',9160)二进制=('127.0.0.2',9042)存储=('127.0.0.2',7000)jmx_port=7200remote_debug_port=0initial_token=-3074457345618258603pid=22484C:Usersmyusername>ccm node3 显示节点3:向上集群=mytestclusterauto_bootstrap=假节俭=('127.0.0.3',9160)二进制=('127.0.0.3',9042)存储=('127.0.0.3',7000)jmx_port=7300remote_debug_port=0initial_token=3074457345618258602pid=6308

I am looking for a set of instructions to create a local multi-node Cassandra 2.x cluster on a Window 7 64 bit PC.

It should preferably use CCM "Cassandra Cluster Manager" and allow management using DataStax OpsCenter

I followed the instructions in "Getting Started with Apache Cassandra on Windows the Easy Way" but they are for a single node cluster.

EDIT: I got stuck on deploying OpsCenter agents on each node using CCM, any ideas?

解决方案

Articles used for this tutorial:

See also:

Prerequisites:

The following tools are assumed to be already installed:

  • JDK 7 or older
  • ANT build tool

Step 1: Install Python

Download and install latest version of Python 2.x from here e.g. https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi

Note: This will also install "pip" tool

The following directories need to be added to the PATH

<PYTHON_INSTALL_DIR>Python
<PYTHON_INSTALL_DIR>PythonScripts
<ANT_INSTALL_DIR>in

Step 2: Install CCM "Cassandra Cluster Manager"

In a new Command Prompt/Powershell window (login as yourself)

type "pip install ccm" – which will automatically download and install ccm

> pip install ccm
Collecting ccm
  Downloading ccm-2.0.6.tar.gz (56kB)
    100% |################################| 57kB 1.8MB/s
Collecting pyYaml (from ccm)
  Downloading PyYAML-3.11.tar.gz (248kB)
    100% |################################| 249kB 1.7MB/s
Collecting six>=1.4.1 (from ccm)
  Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: pyYaml, six, ccm
  Running setup.py install for pyYaml
  Running setup.py install for ccm
Successfully installed ccm-2.0.6 pyYaml-3.11 six-1.10.0

Step 3: Install "psutil (python system and process utilities)"

In the same window as for Step 2:

type "pip install psutil" – – which will automatically download and install psutil

> pip install psutil
Collecting psutil
  Downloading psutil-3.3.0-cp27-none-win_amd64.whl (92kB)
    100% |################################| 94kB 1.4MB/s
Installing collected packages: psutil
Successfully installed psutil-3.3.0

Note: This window can now be closed

Step 4: Set-ExecutionPolicy Unrestricted In a new Powershell window (login as local admin), type "Set-ExecutionPolicy Unrestricted"

*Note: You must set the execution policy of Windows Powershell to allow CCM to launch instances of Cassandra. An unrestricted execution policy will also allow CCM to run on the regular command prompt (cmd) as well as Windows Powershell

PS C:Windowssystem32> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

Step 5: Register PY extension

Note: Add .PY extension to environment variable $PATHEXT, to allow ccm to be executed from any location (run on PowerShell as administrator):

In the same window as for Step 4 type

[Environment]::SetEnvironmentVariable("PATHEXT", "$env:PATHEXT;.PY", "MACHINE")

Note: This window can now be closed

Step 6: Check if CCM is up and running

In a new Command Prompt window (login as yourself) type:

>ccm status
No currently active cluster (use ccm cluster switch)

Step 7: Update hosts file

Open Notepad as Administrator and the following lines to the C:WindowsSystem32driversetchosts file:

#cassandra nodes
127.0.0.1               127.0.0.2
127.0.0.1               127.0.0.3
127.0.0.1               127.0.0.4
127.0.0.1               127.0.0.5
127.0.0.1               127.0.0.6

Step 8: Create and populate a 3 node cluster using Cassandra v2.1.2

Note: This will download version 2.1.2 of Cassandra, build it and then use it to create a new CCM cluster called "mytestcluster".

  • Cassandra installation path %USERPROFILE%.ccm epository2.1.2
  • "test" cluster path %USERPROFILE%.ccm est

C:Usersmyusername>ccm create mytestcluster -v 2.1.2
Downloading http://archive.apache.org/dist/cassandra/2.1.2/apache-cassandra-2.1.2-bin.tar.gz to c:usersmyusernameappdatalocal	empccm-qwauvs.tar.gz (21.735MB)
  22790390  [100.00%]
Extracting c:usersmyusernameappdatalocal	empccm-qwauvs.tar.gz as version 2.1.2 ...

Current cluster is now: mytestcluster

C:Usersmyusername>ccm status
Cluster: 'mytestcluster'
------------------------
No node in this cluster yet

C:Usersmyusername>ccm populate -n 3

C:Usersmyusername>ccm status
Cluster: 'mytestcluster'
------------------------
node1: DOWN (Not initialized)
node3: DOWN (Not initialized)
node2: DOWN (Not initialized)   

C:Usersmyusername>ccm start
Started: node1 with pid: 17432
Started: node3 with pid: 6308
Started: node2 with pid: 22484

C:Usersmyusername>ccm status
Cluster: 'mytestcluster'
------------------------
node1: UP
node3: UP
node2: UP

C:Usersmyusername>ccm jconsole

C:Usersmyusername>ccm node1 show
node1: UP
       cluster=mytestcluster
       auto_bootstrap=False
       thrift=('127.0.0.1', 9160)
       binary=('127.0.0.1', 9042)
       storage=('127.0.0.1', 7000)
       jmx_port=7100
       remote_debug_port=0
       initial_token=-9223372036854775808
       pid=17432

C:Usersmyusername>ccm node2 show
node2: UP
       cluster=mytestcluster
       auto_bootstrap=False
       thrift=('127.0.0.2', 9160)
       binary=('127.0.0.2', 9042)
       storage=('127.0.0.2', 7000)
       jmx_port=7200
       remote_debug_port=0
       initial_token=-3074457345618258603
       pid=22484

C:Usersmyusername>ccm node3 show
node3: UP
       cluster=mytestcluster
       auto_bootstrap=False
       thrift=('127.0.0.3', 9160)
       binary=('127.0.0.3', 9042)
       storage=('127.0.0.3', 7000)
       jmx_port=7300
       remote_debug_port=0
       initial_token=3074457345618258602
       pid=6308

这篇关于如何在 Windows 7 64 位上创建本地多节点 Cassandra 集群?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆