首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在Windows 7 64位上创建本地多节点Cassandra集群?

如何在Windows 7 64位上创建本地多节点Cassandra集群?
EN

Stack Overflow用户
提问于 2015-12-10 10:29:29
回答 1查看 4.4K关注 0票数 1

我正在寻找一组指令,以创建一个本地多节点卡桑德拉 2.x集群窗口7 64位PC。

最好使用CCM“Cassandra群集管理器”,允许使用DataStax OpsCenter进行管理。

我遵循了“在Windows上开始使用的简单方法”中的说明,但它们是针对单个节点集群的。

编辑:我在每个节点上使用CCM部署OpsCenter代理,有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2015-12-10 10:33:59

用于本教程的文章:

另请参阅:

  • 在Windows上开始使用的简单方法
  • 卡桑德拉DevCenter (免费注册)

Prerequisites:

假定已经安装了下列工具:

  • JDK 7或以上
  • 蚁群生成工具

步骤1:安装Python

这里下载并安装Python2.x的最新版本,例如https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi

注意:这也将安装“pip”工具。

需要将下列目录添加到路径中

代码语言:javascript
运行
复制
<PYTHON_INSTALL_DIR>\Python
<PYTHON_INSTALL_DIR>\Python\Scripts
<ANT_INSTALL_DIR>\bin

步骤2:安装CCM“Cassandra群集管理器”

在新的命令提示符/Powershell窗口中(以自己的身份登录)

输入“pip”-它将自动下载和安装ccm

代码语言:javascript
运行
复制
> 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

步骤3:安装“psutil (python和流程实用程序)”

在步骤2的同一窗口中:

输入“psutil”--这将自动下载和安装psutil

代码语言:javascript
运行
复制
> 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

注意:此窗口现在可以关闭。

步骤4:在新的Powershell窗口中设置-ExecutionPolicy不受限制的(以本地管理身份登录),键入“Set-ExecutionPolicy无限制”

*注意:必须设置的执行策略,以允许CCM启动Cassandra实例。不受限制的执行策略还允许CCM在常规命令提示符(cmd)和Windows上运行

代码语言:javascript
运行
复制
PS C:\Windows\system32> 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

步骤5:注册PY扩展

注意:将.PY扩展添加到环境变量$PATHEXT中,以允许从任何位置执行PowerShell (以管理员身份在PowerShell上运行):

在与步骤4相同的窗口中

代码语言:javascript
运行
复制
[Environment]::SetEnvironmentVariable("PATHEXT", "$env:PATHEXT;.PY", "MACHINE")

注意:此窗口现在可以关闭。

步骤6:检查CCM是否已启动并运行

在新的命令提示符窗口(以自己身份登录)中,键入:

代码语言:javascript
运行
复制
>ccm status
No currently active cluster (use ccm cluster switch)

步骤7:更新主机文件

以管理员身份打开记事本,并在C:\Windows\System32 32\drivers\etc\host文件中插入以下行:

代码语言:javascript
运行
复制
#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

步骤8:使用Cassandrav2.1.2创建和填充一个3节点集群

注意:这将下载Cassandra的2.1.2版本,构建它,然后使用它创建一个名为“mytest群集”的新CCM集群。

  • Cassandra安装路径%USERPROFILE%..ccm\存储库\2.1.2
  • “测试”集群路径%USERPROFILE%.ccm\test
代码语言:javascript
运行
复制
C:\Users\myusername>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:\users\myusername\appdata\local\temp\ccm-qwauvs.tar.gz (21.735MB)
  22790390  [100.00%]
Extracting c:\users\myusername\appdata\local\temp\ccm-qwauvs.tar.gz as version 2.1.2 ...

Current cluster is now: mytestcluster

C:\Users\myusername>ccm status
Cluster: 'mytestcluster'
------------------------
No node in this cluster yet

C:\Users\myusername>ccm populate -n 3

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

C:\Users\myusername>ccm start
Started: node1 with pid: 17432
Started: node3 with pid: 6308
Started: node2 with pid: 22484

C:\Users\myusername>ccm status
Cluster: 'mytestcluster'
------------------------
node1: UP
node3: UP
node2: UP

C:\Users\myusername>ccm jconsole

代码语言:javascript
运行
复制
C:\Users\myusername>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:\Users\myusername>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:\Users\myusername>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
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34199466

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档