You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/11/06 01:15:04 UTC
[18/50] git commit: Fixed opscenter wiring and cassandra setup
Fixed opscenter wiring and cassandra setup
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/eec9a620
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/eec9a620
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/eec9a620
Branch: refs/heads/two-dot-o
Commit: eec9a620eaf82cd28149b32d3aa7978a3170dd79
Parents: a3980d0
Author: Todd Nine <tn...@apigee.com>
Authored: Sat Nov 1 16:57:02 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Sat Nov 1 16:57:02 2014 -0600
----------------------------------------------------------------------
.../dist/init_instance/init_opscenter_server.sh | 20 ++--
.../src/main/groovy/configure_opscenter.groovy | 120 -------------------
.../groovy/configure_opscenter_cassandra.groovy | 120 +++++++++++++++++++
.../groovy/configure_opscenter_usergrid.groovy | 55 +++++++++
4 files changed, 187 insertions(+), 128 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eec9a620/stack/awscluster/src/main/dist/init_instance/init_opscenter_server.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/init_opscenter_server.sh b/stack/awscluster/src/main/dist/init_instance/init_opscenter_server.sh
index 3780c6a..5df47cf 100644
--- a/stack/awscluster/src/main/dist/init_instance/init_opscenter_server.sh
+++ b/stack/awscluster/src/main/dist/init_instance/init_opscenter_server.sh
@@ -32,9 +32,6 @@ dpkg-reconfigure -f noninteractive tzdata
. /etc/profile.d/aws-credentials.sh
. /etc/profile.d/usergrid-env.sh
-cd /usr/share/usergrid/init_instance
-./create_raid0.sh
-
# Install the easy stuff
PKGS="ntp unzip groovy curl"
apt-get update
@@ -59,8 +56,7 @@ groovy tag_instance.groovy -BUILD-IN-PROGRESS
cd /usr/share/usergrid/init_instance
./install_oraclejdk.sh
-# Install and stop Cassandra
-pushd /etc/apt/sources.list.d
+# Install and stop Cassandra
curl -L http://debian.datastax.com/debian/repo_key | apt-key add -
@@ -80,11 +76,11 @@ cd /usr/share/usergrid/scripts
groovy registry_register.groovy opscenter
#TODO make this configurable for the box sizes
-#Set or min/max heap to 8GB
-sed -i.bak s/calculate_heap_sizes\(\)/MAX_HEAP_SIZE=\"8G\"\\nHEAP_NEWSIZE=\"1200M\"\\n\\ncalculate_heap_sizes\(\)/g /etc/cassandra/cassandra-env.sh
+#Leave default heaps in place
+#sed -i.bak s/calculate_heap_sizes\(\)/MAX_HEAP_SIZE=\"2G\"\\nHEAP_NEWSIZE=\"1200M\"\\n\\ncalculate_heap_sizes\(\)/g /etc/cassandra/cassandra-env.sh
cd /usr/share/usergrid/scripts
-groovy configure_opscenter.groovy > /etc/cassandra/cassandra.yaml
+groovy configure_opscenter_cassandra.groovy > /etc/cassandra/cassandra.yaml
/etc/init.d/cassandra start
@@ -95,6 +91,14 @@ echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/a
apt-get update
apt-get --force-yes -y install opscenter
+sudo service opscenterd stop
+
+#Configure the usergrid cluster to store data locally, not on the target cluster and auto boostrap it
+cd /usr/share/usergrid/scripts
+groovy wait_for_instances.groovy cassandra 1
+mkdir -p /etc/opscenter/clusters
+groovy configure_opscenter_usergrid.groovy > /etc/opscenter/clusters/$CASSANDRA_CLUSTER_NAME.conf
+
sudo service opscenterd start
# tag last so we can see in the console that the script ran to completion
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eec9a620/stack/awscluster/src/main/groovy/configure_opscenter.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_opscenter.groovy b/stack/awscluster/src/main/groovy/configure_opscenter.groovy
deleted file mode 100644
index b9239a1..0000000
--- a/stack/awscluster/src/main/groovy/configure_opscenter.groovy
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * * Licensed to the Apache Software Foundation (ASF) under one
- * * or more contributor license agreements. See the NOTICE file
- * * distributed with this work for additional information
- * * regarding copyright ownership. The ASF licenses this file
- * * to you 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.
- *
- */
-
-
-// configure_cassandra.groovy
-//
-// Emits Cassandra config file based on environment and Cassandra node
-// registry in SimpleDB
-//
-import com.amazonaws.auth.*
-import com.amazonaws.services.simpledb.*
-import com.amazonaws.services.simpledb.model.*
-
-
-String hostName = (String)System.getenv().get("PUBLIC_HOSTNAME")
-// build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
-
-
-
-def cassandraConfig = """
-
-
-cluster_name: 'opscenter'
-listen_address: ${hostName}
-seed_provider:
- - class_name: org.apache.cassandra.locator.SimpleSeedProvider
- parameters:
- - seeds: "${hostName}"
-auto_bootstrap: false
-num_tokens: 256
-hinted_handoff_enabled: true
-hinted_handoff_throttle_in_kb: 1024
-max_hints_delivery_threads: 2
-authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
-authorizer: org.apache.cassandra.auth.AllowAllAuthorizer
-partitioner: org.apache.cassandra.dht.Murmur3Partitioner
-data_file_directories:
- - /mnt/data/cassandra/data
-commitlog_directory: /mnt/data/cassandra/commitlog
-disk_failure_policy: stop
-key_cache_size_in_mb: 2048
-key_cache_save_period: 14400
-row_cache_size_in_mb: 2048
-row_cache_save_period: 14400
-row_cache_provider: SerializingCacheProvider
-saved_caches_directory: /mnt/data/cassandra/saved_caches
-commitlog_sync: periodic
-commitlog_sync_period_in_ms: 10000
-commitlog_segment_size_in_mb: 32
-flush_largest_memtables_at: 0.75
-reduce_cache_sizes_at: 0.85
-reduce_cache_capacity_to: 0.6
-concurrent_reads: 32
-concurrent_writes: 32
-memtable_flush_queue_size: 4
-trickle_fsync: false
-trickle_fsync_interval_in_kb: 10240
-storage_port: 7000
-ssl_storage_port: 7001
-rpc_address: 0.0.0.0
-start_native_transport: false
-native_transport_port: 9042
-start_rpc: true
-rpc_port: 9160
-rpc_keepalive: true
-rpc_server_type: sync
-thrift_framed_transport_size_in_mb: 15
-thrift_max_message_length_in_mb: 16
-incremental_backups: false
-snapshot_before_compaction: false
-auto_snapshot: true
-column_index_size_in_kb: 64
-in_memory_compaction_limit_in_mb: 64
-multithreaded_compaction: false
-compaction_throughput_mb_per_sec: 16
-compaction_preheat_key_cache: true
-read_request_timeout_in_ms: 10000
-range_request_timeout_in_ms: 10000
-write_request_timeout_in_ms: 10000
-truncate_request_timeout_in_ms: 60000
-request_timeout_in_ms: 10000
-cross_node_timeout: false
-endpoint_snitch: Ec2Snitch
-dynamic_snitch_update_interval_in_ms: 100
-dynamic_snitch_reset_interval_in_ms: 600000
-dynamic_snitch_badness_threshold: 0.1
-request_scheduler: org.apache.cassandra.scheduler.NoScheduler
-index_interval: 128
-server_encryption_options:
- internode_encryption: none
- keystore: conf/.keystore
- keystore_password: cassandra
- truststore: conf/.truststore
- truststore_password: cassandra
-client_encryption_options:
- enabled: false
- keystore: conf/.keystore
- keystore_password: cassandra
-internode_compression: all
-"""
-
-println cassandraConfig
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eec9a620/stack/awscluster/src/main/groovy/configure_opscenter_cassandra.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_opscenter_cassandra.groovy b/stack/awscluster/src/main/groovy/configure_opscenter_cassandra.groovy
new file mode 100644
index 0000000..b9239a1
--- /dev/null
+++ b/stack/awscluster/src/main/groovy/configure_opscenter_cassandra.groovy
@@ -0,0 +1,120 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you 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.
+ *
+ */
+
+
+// configure_cassandra.groovy
+//
+// Emits Cassandra config file based on environment and Cassandra node
+// registry in SimpleDB
+//
+import com.amazonaws.auth.*
+import com.amazonaws.services.simpledb.*
+import com.amazonaws.services.simpledb.model.*
+
+
+String hostName = (String)System.getenv().get("PUBLIC_HOSTNAME")
+// build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
+
+
+
+def cassandraConfig = """
+
+
+cluster_name: 'opscenter'
+listen_address: ${hostName}
+seed_provider:
+ - class_name: org.apache.cassandra.locator.SimpleSeedProvider
+ parameters:
+ - seeds: "${hostName}"
+auto_bootstrap: false
+num_tokens: 256
+hinted_handoff_enabled: true
+hinted_handoff_throttle_in_kb: 1024
+max_hints_delivery_threads: 2
+authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
+authorizer: org.apache.cassandra.auth.AllowAllAuthorizer
+partitioner: org.apache.cassandra.dht.Murmur3Partitioner
+data_file_directories:
+ - /mnt/data/cassandra/data
+commitlog_directory: /mnt/data/cassandra/commitlog
+disk_failure_policy: stop
+key_cache_size_in_mb: 2048
+key_cache_save_period: 14400
+row_cache_size_in_mb: 2048
+row_cache_save_period: 14400
+row_cache_provider: SerializingCacheProvider
+saved_caches_directory: /mnt/data/cassandra/saved_caches
+commitlog_sync: periodic
+commitlog_sync_period_in_ms: 10000
+commitlog_segment_size_in_mb: 32
+flush_largest_memtables_at: 0.75
+reduce_cache_sizes_at: 0.85
+reduce_cache_capacity_to: 0.6
+concurrent_reads: 32
+concurrent_writes: 32
+memtable_flush_queue_size: 4
+trickle_fsync: false
+trickle_fsync_interval_in_kb: 10240
+storage_port: 7000
+ssl_storage_port: 7001
+rpc_address: 0.0.0.0
+start_native_transport: false
+native_transport_port: 9042
+start_rpc: true
+rpc_port: 9160
+rpc_keepalive: true
+rpc_server_type: sync
+thrift_framed_transport_size_in_mb: 15
+thrift_max_message_length_in_mb: 16
+incremental_backups: false
+snapshot_before_compaction: false
+auto_snapshot: true
+column_index_size_in_kb: 64
+in_memory_compaction_limit_in_mb: 64
+multithreaded_compaction: false
+compaction_throughput_mb_per_sec: 16
+compaction_preheat_key_cache: true
+read_request_timeout_in_ms: 10000
+range_request_timeout_in_ms: 10000
+write_request_timeout_in_ms: 10000
+truncate_request_timeout_in_ms: 60000
+request_timeout_in_ms: 10000
+cross_node_timeout: false
+endpoint_snitch: Ec2Snitch
+dynamic_snitch_update_interval_in_ms: 100
+dynamic_snitch_reset_interval_in_ms: 600000
+dynamic_snitch_badness_threshold: 0.1
+request_scheduler: org.apache.cassandra.scheduler.NoScheduler
+index_interval: 128
+server_encryption_options:
+ internode_encryption: none
+ keystore: conf/.keystore
+ keystore_password: cassandra
+ truststore: conf/.truststore
+ truststore_password: cassandra
+client_encryption_options:
+ enabled: false
+ keystore: conf/.keystore
+ keystore_password: cassandra
+internode_compression: all
+"""
+
+println cassandraConfig
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eec9a620/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy b/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy
new file mode 100644
index 0000000..882a04a
--- /dev/null
+++ b/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy
@@ -0,0 +1,55 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements. See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership. The ASF licenses this file
+ * * to you 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.
+ *
+ */
+
+
+// configure_cassandra.groovy
+//
+// Emits Cassandra config file based on environment and Cassandra node
+// registry in SimpleDB
+//
+
+
+String hostName = (String)System.getenv().get("PUBLIC_HOSTNAME")
+// build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
+
+NodeRegistry registry = new NodeRegistry();
+
+def selectResult = registry.searchNode('cassandra')
+def seeds = ""
+def sep = ""
+for (host in selectResult) {
+ seeds = "${seeds}${sep}${host}"
+ sep = ","
+}
+
+
+//We need to point to at least 1 node in the cassandra cluster so that we can bootstrap monitoring
+def usergridConfig = """
+
+[cassandra]
+seed_hosts = ${seeds}
+
+[storage_cassandra]
+seed_hosts = ${hostName}
+api_port = 9160
+"""
+
+println usergridConfig