社区:https://github.com/Symantec/ambari-cassandra-service
在HDP集群上安装和管理Cassandra服务,Apache Cassandra是一个开源的分布式数据库管理系统设计用于处理大量数据在许多商品服务器,提供高可用性,没有单点故障。
Setup
我是HDP 2.3
下载Cassandra service文件夹
1 VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - ([0-9].[0-9]).*/1/'` 2 sudo git clone https://github.com/Symantec/ambari-cassandra-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/CASSANDRA
1.获取HDP版本号
2.下载Cassandra service文件夹到相应目录
3.Restart Ambari
sudo service ambari-server restart
4.配置Cassandra的yum源
vi /etc/yum.repos.d/datastax.repo
[datastax] name= Cassandra baseurl=http://rpm.datastax.com/community enabled=1 gpgcheck=0
yum search dsc21
yum search opscenter
这两个包是在ambari-cassandra-service/metainfo.xml中定义的
1 <?xml version="1.0"?> 2 <metainfo> 3 <schemaVersion>2.0</schemaVersion> 4 <services> 5 <service> 6 <name>Cassandra</name> 7 <displayName>Cassandra</displayName> 8 <comment>Distributed database</comment> 9 <version>2.1</version> 10 <components> 11 <component> 12 <name>Cluster-Hosts</name> 13 <displayName>Cluster Nodes</displayName> 14 <category>SLAVE</category> 15 <cardinality>1+</cardinality> 16 <commandScript> 17 <script>scripts/cassandra_master.py</script> 18 <scriptType>PYTHON</scriptType> 19 <timeout>600</timeout> 20 </commandScript> 21 </component> 22 <component> 23 <name>Cluster_client</name> 24 <displayName>Cluster Client</displayName> 25 <category>CLIENT</category> 26 <cardinality>0+</cardinality> 27 <commandScript> 28 <script>scripts/clients.py</script> 29 <scriptType>PYTHON</scriptType> 30 <timeout>600</timeout> 31 </commandScript> 32 </component> 33 </components> 34 <osSpecifics> 35 <osSpecific> 36 <osFamily>any</osFamily> 37 <packages> 38 <package> 39 <name>dsc21</name> 40 </package> 41 <package> 42 <name>opscenter</name> 43 </package> 44 </packages> 45 </osSpecific> 46 </osSpecifics> 47 <commandScript> 48 <script>scripts/service_check.py</script> 49 <scriptType>PYTHON</scriptType> 50 <timeout>300</timeout> 51 </commandScript> 52 <configuration-dependencies> 53 <config-type>cassandra-env</config-type> 54 </configuration-dependencies> 55 <restartRequiredAfterChange>true</restartRequiredAfterChange> 56 57 </service> 58 </services> 59 </metainfo>
注:第39,42行定义安装包。
5.Ambari界面添加cassandra服务
注:红色为主节点主机名
原因:lh-2和lh-3机器上未配置cassandra包的yum源。
解决办法:
命令:
1 scp /etc/yum.repos.d/datastax.repo lh-2:/etc/yum.repos.d/ 2 scp /etc/yum.repos.d/datastax.repo lh-3:/etc/yum.repos.d/
配置完yum源之后,然后按照上面步骤继续安装。