[Cassandra] Use simple software configuration
Change-Id: Ia838a0ba8d72f9446439bc1992baf807d5917570 Partially-Implements: bp refactor-apps-scripts
This commit is contained in:
parent
3b51222b09
commit
e022463cf5
|
@ -48,7 +48,7 @@ Methods:
|
||||||
- $.regularNodes.pselect($.spawnInstance())
|
- $.regularNodes.pselect($.spawnInstance())
|
||||||
|
|
||||||
# Collect internal IPs of seed nodes
|
# Collect internal IPs of seed nodes
|
||||||
- $seedNodesAsString: join(',', $.seedNodes.select($.getInternalIp()))
|
- $seedNodesAsString: $.seedNodes.select($.getInternalIp()).join(',')
|
||||||
|
|
||||||
# Deploy Cassandra with default conf
|
# Deploy Cassandra with default conf
|
||||||
- Parallel:
|
- Parallel:
|
||||||
|
|
|
@ -15,7 +15,7 @@ Namespaces:
|
||||||
std: io.murano
|
std: io.murano
|
||||||
res: io.murano.resources
|
res: io.murano.resources
|
||||||
sys: io.murano.system
|
sys: io.murano.system
|
||||||
|
conf: io.murano.configuration
|
||||||
|
|
||||||
Name: CassandraNode
|
Name: CassandraNode
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ Methods:
|
||||||
.init:
|
.init:
|
||||||
Body:
|
Body:
|
||||||
- $._environment: $.find(std:Environment).require()
|
- $._environment: $.find(std:Environment).require()
|
||||||
- $.resources: new(sys:Resources)
|
|
||||||
|
|
||||||
updateConfiguration:
|
updateConfiguration:
|
||||||
Arguments:
|
Arguments:
|
||||||
|
@ -41,14 +40,16 @@ Methods:
|
||||||
Body:
|
Body:
|
||||||
# Listen address is internal (so it gets resolved by node itself correctly)
|
# Listen address is internal (so it gets resolved by node itself correctly)
|
||||||
- $listenAddress: $.instance.ipAddresses[0]
|
- $listenAddress: $.instance.ipAddresses[0]
|
||||||
- $template: $.resources.yaml('UpdateCassandraYaml.template').bind(dict(
|
|
||||||
clusterName => $clusterName,
|
- $replacements:
|
||||||
seedNodes => $seedNodes,
|
"%LISTEN_ADDRESS%": $listenAddress
|
||||||
listenAddress => $listenAddress
|
"%CLUSTER_NAME%": $clusterName
|
||||||
))
|
"%SEED_NODES%": $seedNodes
|
||||||
|
- $file: sys:Resources.string('updateCassandraYaml.sh').replace($replacements)
|
||||||
|
- conf:Linux.runCommand($.instance.agent, $file)
|
||||||
|
|
||||||
- $msg: format('Updating Cassandra configuration at node "{0}"', $listenAddress)
|
- $msg: format('Updating Cassandra configuration at node "{0}"', $listenAddress)
|
||||||
- $._environment.reporter.report($this, $msg)
|
- $._environment.reporter.report($this, $msg)
|
||||||
- $.instance.agent.call($template, $.resources)
|
|
||||||
|
|
||||||
|
|
||||||
configureSecurityGroups:
|
configureSecurityGroups:
|
||||||
|
@ -97,8 +98,8 @@ Methods:
|
||||||
Then:
|
Then:
|
||||||
- $address: $.instance.ipAddresses[0]
|
- $address: $.instance.ipAddresses[0]
|
||||||
- $._environment.reporter.report($this, 'Deploying Cassandra node "{0}"'.format($address))
|
- $._environment.reporter.report($this, 'Deploying Cassandra node "{0}"'.format($address))
|
||||||
- $template: $.resources.yaml('DeployCassandra.template')
|
- $file: sys:Resources.string('deployCassandra.sh')
|
||||||
- $.instance.agent.call($template, $.resources)
|
- conf:Linux.runCommand($.instance.agent, $file)
|
||||||
- $.setAttr(deployed, true)
|
- $.setAttr(deployed, true)
|
||||||
|
|
||||||
getInternalIp:
|
getInternalIp:
|
||||||
|
@ -113,7 +114,5 @@ Methods:
|
||||||
Body:
|
Body:
|
||||||
- $msg: format('Restarting Cassandra node "{0}"', $.instance.name)
|
- $msg: format('Restarting Cassandra node "{0}"', $.instance.name)
|
||||||
- $._environment.reporter.report($this, $msg)
|
- $._environment.reporter.report($this, $msg)
|
||||||
- $template: $.resources.yaml('RestartCassandra.template').bind(dict(
|
- $command: format('sleep {0}; sudo service cassandra restart', $delay)
|
||||||
delay => $delay
|
- conf:Linux.runCommand($.instance.agent, $command)
|
||||||
))
|
|
||||||
- $.instance.agent.call($template, $.resources)
|
|
|
@ -1,31 +0,0 @@
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
FormatVersion: 2.0.0
|
|
||||||
Version: 1.0.0
|
|
||||||
Name: Deploy Cassandra
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
appName: $appName
|
|
||||||
|
|
||||||
Body: |
|
|
||||||
return deploy(args.appName).stdout
|
|
||||||
|
|
||||||
Scripts:
|
|
||||||
deploy:
|
|
||||||
Type: Application
|
|
||||||
Version: 1.0.0
|
|
||||||
EntryPoint: deployCassandra.sh
|
|
||||||
Files: []
|
|
||||||
Options:
|
|
||||||
captureStdout: false
|
|
||||||
captureStderr: true
|
|
|
@ -1,32 +0,0 @@
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
FormatVersion: 2.0.0
|
|
||||||
Version: 1.0.0
|
|
||||||
Name: Restart Cassandra
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
delay: $delay
|
|
||||||
|
|
||||||
Body: |
|
|
||||||
restart('{0}'.format(args.delay))
|
|
||||||
|
|
||||||
Scripts:
|
|
||||||
restart:
|
|
||||||
Type: Application
|
|
||||||
Version: 1.0.0
|
|
||||||
EntryPoint: restartCassandra.sh
|
|
||||||
Files: []
|
|
||||||
Options:
|
|
||||||
captureStdout: true
|
|
||||||
captureStderr: false
|
|
||||||
verifyExitcode: false
|
|
|
@ -1,34 +0,0 @@
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
FormatVersion: 2.0.0
|
|
||||||
Version: 1.0.0
|
|
||||||
Name: Update Cassandra Yaml
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
clusterName: $clusterName
|
|
||||||
seedNodes: $seedNodes
|
|
||||||
listenAddress: $listenAddress
|
|
||||||
|
|
||||||
Body: |
|
|
||||||
configure('{0} {1} {2}'.format(args.clusterName, args.seedNodes, args.listenAddress))
|
|
||||||
|
|
||||||
Scripts:
|
|
||||||
configure:
|
|
||||||
Type: Application
|
|
||||||
Version: 1.0.0
|
|
||||||
EntryPoint: updateCassandraYaml.sh
|
|
||||||
Files: []
|
|
||||||
Options:
|
|
||||||
captureStdout: true
|
|
||||||
captureStderr: true
|
|
||||||
|
|
|
@ -11,21 +11,17 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
CLUSTER_NAME="$1"
|
|
||||||
SEED_NODES="$2"
|
|
||||||
LISTEN_ADDRESS="$3"
|
|
||||||
|
|
||||||
## Configure Cassandra to use seed nodes
|
## Configure Cassandra to use seed nodes
|
||||||
# Set cluster name
|
# Set cluster name
|
||||||
sed -e "s/cluster_name:.*/cluster_name: \'$CLUSTER_NAME\'/g" -i /etc/cassandra/cassandra.yaml
|
sed -e "s/cluster_name:.*/cluster_name: \'%CLUSTER_NAME%\'/g" -i /etc/cassandra/cassandra.yaml
|
||||||
# Seed provider class name
|
# Seed provider class name
|
||||||
sed -e "s/- class_name:.*/- class_name: org.apache.cassandra.locator.SimpleSeedProvider/g" -i /etc/cassandra/cassandra.yaml
|
sed -e "s/- class_name:.*/- class_name: org.apache.cassandra.locator.SimpleSeedProvider/g" -i /etc/cassandra/cassandra.yaml
|
||||||
# Set seed nodes - nodes used to bootstrap other nodes
|
# Set seed nodes - nodes used to bootstrap other nodes
|
||||||
sed -e "s/seeds:.*/seeds: \"$SEED_NODES\"/g" -i /etc/cassandra/cassandra.yaml
|
sed -e "s/seeds:.*/seeds: \"$SEED_NODES\"/g" -i /etc/cassandra/cassandra.yaml
|
||||||
# Set listen address and endpoint snitch class
|
# Set listen address and endpoint snitch class
|
||||||
sed -e "s/listen_address:.*/listen_address: $LISTEN_ADDRESS/g" -i /etc/cassandra/cassandra.yaml
|
sed -e "s/listen_address:.*/listen_address: %LISTEN_ADDRESS%/g" -i /etc/cassandra/cassandra.yaml
|
||||||
sed -e "s/endpoint_snitch:.*/endpoint_snitch: GossipingPropertyFileSnitch/g" -i /etc/cassandra/cassandra.yaml
|
sed -e "s/endpoint_snitch:.*/endpoint_snitch: GossipingPropertyFileSnitch/g" -i /etc/cassandra/cassandra.yaml
|
||||||
# Set RPC address
|
# Set RPC address
|
||||||
sed -e "s/^rpc_address:.*/rpc_address: 0.0.0.0/g" -i /etc/cassandra/cassandra.yaml
|
sed -e "s/^rpc_address:.*/rpc_address: 0.0.0.0/g" -i /etc/cassandra/cassandra.yaml
|
||||||
sed -e "s/#\s*broadcast_rpc_address:.*/broadcast_rpc_address: $LISTEN_ADDRESS/g" -i /etc/cassandra/cassandra.yaml
|
sed -e "s/#\s*broadcast_rpc_address:.*/broadcast_rpc_address: %LISTEN_ADDRESS%/g" -i /etc/cassandra/cassandra.yaml
|
||||||
|
|
Loading…
Reference in New Issue