Changed setup so that the first rest server performs migrations, system setup, then modifies the column families with the performance tweaks.
Fixes setup issue with keyspaces Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/54772ab0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/54772ab0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/54772ab0 Branch: refs/heads/two-dot-o Commit: 54772ab0af08a9651d6fe166fbbee369adeb6a5f Parents: 3495001 Author: Todd Nine <[email protected]> Authored: Mon Nov 10 12:49:52 2014 -0700 Committer: Todd Nine <[email protected]> Committed: Mon Nov 10 12:49:52 2014 -0700 ---------------------------------------------------------------------- stack/awscluster/src/main/cql/create_locks.cql | 26 -------- .../awscluster/src/main/cql/create_usergrid.cql | 28 --------- .../main/cql/create_usergrid_applications.cql | 47 -------------- stack/awscluster/src/main/cql/update_locks.cql | 23 +++++++ .../awscluster/src/main/cql/update_usergrid.cql | 27 ++++++++ .../main/cql/update_usergrid_applications.cql | 46 ++++++++++++++ .../main/dist/init_instance/create_keyspaces.sh | 61 ------------------ .../main/dist/init_instance/init_db_server.sh | 4 -- .../main/dist/init_instance/init_rest_server.sh | 20 +++++- .../main/dist/init_instance/update_keyspaces.sh | 66 ++++++++++++++++++++ .../src/main/groovy/NodeRegistry.groovy | 8 ++- stack/awscluster/ugcluster-cf.json | 14 ++--- .../usergrid/corepersistence/CpSetup.java | 4 +- .../persistence/cassandra/CassandraService.java | 3 + 14 files changed, 198 insertions(+), 179 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/cql/create_locks.cql ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/cql/create_locks.cql b/stack/awscluster/src/main/cql/create_locks.cql deleted file mode 100644 index fc1de2a..0000000 --- a/stack/awscluster/src/main/cql/create_locks.cql +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. 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. For additional information regarding - * copyright in this work, please see the NOTICE file in the top level - * directory of this distribution. - */ - -drop keyspace Locks; - -create keyspace Locks with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = false; -update keyspace Locks with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = false; - -use Locks; - -create column family HLocks with gc_grace=60 and caching=ALL and read_repair_chance=0.00 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/cql/create_usergrid.cql ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/cql/create_usergrid.cql b/stack/awscluster/src/main/cql/create_usergrid.cql deleted file mode 100644 index deae504..0000000 --- a/stack/awscluster/src/main/cql/create_usergrid.cql +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. 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. For additional information regarding - * copyright in this work, please see the NOTICE file in the top level - * directory of this distribution. - */ - -create keyspace Usergrid with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = true; -update keyspace Usergrid with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = true; - -use Usergrid; - -create column family Applications with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family PrincipalTokens with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Tokens with caching=ALL and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; - http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/cql/create_usergrid_applications.cql ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/cql/create_usergrid_applications.cql b/stack/awscluster/src/main/cql/create_usergrid_applications.cql deleted file mode 100644 index bb3d29a..0000000 --- a/stack/awscluster/src/main/cql/create_usergrid_applications.cql +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. 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. For additional information regarding - * copyright in this work, please see the NOTICE file in the top level - * directory of this distribution. - */ - -create keyspace Usergrid_Applications with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = true; -update keyspace Usergrid_Applications with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = true; - -use Usergrid_Applications; - -create column family Application_Aggregate_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Application_Roles with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Applications with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Consumer_Queue_Messages_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Composite_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Id_Sets with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Index with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Index_Entries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Metadata with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Entity_Unique with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family MQ_Consumers with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family MQ_Consumers_Timeout with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family MQ_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family MQ_Property_Index with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family MQ_Property_Index_Entries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Queue_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Queue_Inbox with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Queue_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Queue_Subscribers with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; -create column family Queue_Subscriptions with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; - http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/cql/update_locks.cql ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/cql/update_locks.cql b/stack/awscluster/src/main/cql/update_locks.cql new file mode 100644 index 0000000..64344f6 --- /dev/null +++ b/stack/awscluster/src/main/cql/update_locks.cql @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. 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. For additional information regarding + * copyright in this work, please see the NOTICE file in the top level + * directory of this distribution. + */ +update keyspace Locks with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = false; + +use Locks; + +update column family HLocks with gc_grace=60 and caching=ALL and read_repair_chance=0.00 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; + http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/cql/update_usergrid.cql ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/cql/update_usergrid.cql b/stack/awscluster/src/main/cql/update_usergrid.cql new file mode 100644 index 0000000..50eb79f --- /dev/null +++ b/stack/awscluster/src/main/cql/update_usergrid.cql @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. 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. For additional information regarding + * copyright in this work, please see the NOTICE file in the top level + * directory of this distribution. + */ + +update keyspace Usergrid with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = true; + +use Usergrid; + +update column family Applications with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family PrincipalTokens with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Tokens with caching=ALL and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; + http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/cql/update_usergrid_applications.cql ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/cql/update_usergrid_applications.cql b/stack/awscluster/src/main/cql/update_usergrid_applications.cql new file mode 100644 index 0000000..253230d --- /dev/null +++ b/stack/awscluster/src/main/cql/update_usergrid_applications.cql @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. 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. For additional information regarding + * copyright in this work, please see the NOTICE file in the top level + * directory of this distribution. + */ + +update keyspace Usergrid_Applications with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : 3} and durable_writes = true; + +use Usergrid_Applications; + +update column family Application_Aggregate_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Application_Roles with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Applications with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Consumer_Queue_Messages_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Composite_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Id_Sets with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Index with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Index_Entries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Metadata with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Entity_Unique with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family MQ_Consumers with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family MQ_Consumers_Timeout with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family MQ_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family MQ_Property_Index with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family MQ_Property_Index_Entries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Queue_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Queue_Inbox with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Queue_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Queue_Subscribers with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; +update column family Queue_Subscriptions with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512}; + http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh b/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh deleted file mode 100644 index e2451e8..0000000 --- a/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. 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. For additional information regarding -# copyright in this work, please see the NOTICE file in the top level -# directory of this distribution. -# - -#Install keyspaces -pushd /etc/apt/sources.list.d - -#Run the cassandra cql to create the keyspaces. Note this only works for the -# us-east region for the replication factor on the keyspaces - -cd /usr/share/usergrid/scripts -FIRSTHOST="$(groovy get_first_instance.groovy cassandra)" - -if [ "$FIRSTHOST"=="$PUBLIC_HOSTNAME" ]; then - -#We have to wait for cass to actually start before we can run our CQL. Sleep 5 seconds between retries -while ! echo exit | nc localhost 9160; do sleep 5; done - -#WE have to remove our -1 from the end, since us-east and us-west dont support -1 in cassandra -CASS_REGION=${EC2_REGION%-1} - - -#Update the keyspace replication and run the cql -sed -i.bak "s/KEYSPACE_REGION/${CASS_REGION}/g" /usr/share/usergrid/cql/create_locks.cql - -/usr/bin/cassandra-cli -f /usr/share/usergrid/cql/create_locks.cql - - - - -#Update the keyspace region and run the cql -sed -i.bak "s/KEYSPACE_REGION/${CASS_REGION}/g" /usr/share/usergrid/cql/create_usergrid.cql - -/usr/bin/cassandra-cli -f /usr/share/usergrid/cql/create_usergrid.cql - - - - -#Update the keyspace region and run the cql -sed -i.bak "s/KEYSPACE_REGION/${CASS_REGION}/g" /usr/share/usergrid/cql/create_usergrid_applications.cql - -/usr/bin/cassandra-cli -f /usr/share/usergrid/cql/create_usergrid_applications.cql - -fi - -popd http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/dist/init_instance/init_db_server.sh ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/dist/init_instance/init_db_server.sh b/stack/awscluster/src/main/dist/init_instance/init_db_server.sh index a9bae98..eb8e1ba 100644 --- a/stack/awscluster/src/main/dist/init_instance/init_db_server.sh +++ b/stack/awscluster/src/main/dist/init_instance/init_db_server.sh @@ -67,10 +67,6 @@ cd /usr/share/usergrid/init_instance cd /usr/share/usergrid/init_instance ./install_cassandra.sh -# Use the CQL to crate the keyspaces -cd /usr/share/usergrid/init_instance -./create_keyspaces.sh - # Install the opscenter agent cd /usr/share/usergrid/init_instance ./install_opscenter_agent.sh http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh index 1fe4bb8..7b6571c 100644 --- a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh +++ b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh @@ -206,12 +206,30 @@ sh /etc/init.d/tomcat7 start #Wait until tomcat starts and we can hit our status page until curl -m 1 -I -X GET http://localhost:8080/status | grep "200 OK"; do sleep 5; done + +#If we're the first rest server, run the migration, the database setup, then run the Cassanda keyspace updates +cd /usr/share/usergrid/scripts +groovy registry_register.groovy rest + +FIRSTHOST="$(groovy get_first_instance.groovy rest)" + +if [ "$FIRSTHOST"=="$PUBLIC_HOSTNAME" ]; then + #Run the migration curl -X PUT http://localhost:8080/system/migrate/run -u superuser:test -#Run the system database setup +#Wait since migration is no-op just needs to ideally run to completion to bring the internal state up to date before +#Running setup +sleep 10 + +#Run the system database setup since migration is a no-op curl -X GET http://localhost:8080/system/database/setup -u superuser:test +cd /usr/share/usergrid/init_instance +./update_keyspaces.sh + +fi + # tag last so we can see in the console that the script ran to completion cd /usr/share/usergrid/scripts groovy tag_instance.groovy http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/dist/init_instance/update_keyspaces.sh ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/dist/init_instance/update_keyspaces.sh b/stack/awscluster/src/main/dist/init_instance/update_keyspaces.sh new file mode 100644 index 0000000..c309879 --- /dev/null +++ b/stack/awscluster/src/main/dist/init_instance/update_keyspaces.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. 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. For additional information regarding +# copyright in this work, please see the NOTICE file in the top level +# directory of this distribution. +# + +#Install keyspaces +pushd /etc/apt/sources.list.d + +#Run the cassandra cql to create the keyspaces. Note this only works for the +# us-east region for the replication factor on the keyspaces + + +#Install cassandra so we have the cli +curl -L http://debian.datastax.com/debian/repo_key | apt-key add - + +sudo cat >> /etc/apt/sources.list.d/cassandra.sources.list << EOF +deb http://debian.datastax.com/community stable main +EOF + +apt-get update +apt-get -y --force-yes install libcap2 cassandra=1.2.19 +/etc/init.d/cassandra stop + +#Get the first instance of cassandra +cd /usr/share/usergrid/scripts +CASSHOST=$(groovy get_first_instance.groovy cassandra) + +#We have to wait for cass to actually start before we can run our CQL. Sleep 5 seconds between retries +while ! echo exit | nc ${CASSHOST} 9160; do sleep 5; done + +#WE have to remove our -1 from the end, since us-east and us-west dont support -1 in cassandra +CASS_REGION=${EC2_REGION%-1} + +#Update the keyspace replication and run the cql +sed -i.bak "s/KEYSPACE_REGION/${CASS_REGION}/g" /usr/share/usergrid/cql/update_locks.cql + +/usr/bin/cassandra-cli -h ${CASSHOST} -f /usr/share/usergrid/cql/update_locks.cql + + +#Update the keyspace region and run the cql +sed -i.bak "s/KEYSPACE_REGION/${CASS_REGION}/g" /usr/share/usergrid/cql/update_usergrid.cql + +/usr/bin/cassandra-cli -h ${CASSHOST} -f /usr/share/usergrid/cql/update_usergrid.cql + + +#Update the keyspace region and run the cql +sed -i.bak "s/KEYSPACE_REGION/${CASS_REGION}/g" /usr/share/usergrid/cql/update_usergrid_applications.cql + +/usr/bin/cassandra-cli -h ${CASSHOST} -f /usr/share/usergrid/cql/update_usergrid_applications.cql + + +popd http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/src/main/groovy/NodeRegistry.groovy ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/groovy/NodeRegistry.groovy b/stack/awscluster/src/main/groovy/NodeRegistry.groovy index 7389073..6291f93 100644 --- a/stack/awscluster/src/main/groovy/NodeRegistry.groovy +++ b/stack/awscluster/src/main/groovy/NodeRegistry.groovy @@ -55,8 +55,9 @@ class NodeRegistry { * @param defNodeType */ def searchNode(def nodeType) { + //order by create time, if we have a conflict, then order by item name def selectResult = sdbClient.select(new SelectRequest((String) \ - "select * from `${domain}` where itemName() is not null and nodetype = '${nodeType}' order by itemName()")) + "select * from `${domain}` where itemName() is not null AND createtime is not null AND nodetype = '${nodeType}' order by createtime")) def result = [] for (item in selectResult.getItems()) { @@ -96,11 +97,14 @@ class NodeRegistry { } else { println "Registering..." def stackAtt = new ReplaceableAttribute("nodetype", nodeType, true) + def nowString = Calendar.getInstance(TimeZone.getTimeZone('UTC')).format("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + def createTime = new ReplaceableAttribute("createtime", nowString, true) def attrs = new ArrayList() attrs.add(stackAtt) + attrs.add(createTime) def par = new PutAttributesRequest(domain, hostName, attrs) sdbClient.putAttributes(par); - println "Registraition done." + println "Registration done." return true; } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/awscluster/ugcluster-cf.json ---------------------------------------------------------------------- diff --git a/stack/awscluster/ugcluster-cf.json b/stack/awscluster/ugcluster-cf.json index 345b5a1..5b599ec 100644 --- a/stack/awscluster/ugcluster-cf.json +++ b/stack/awscluster/ugcluster-cf.json @@ -59,8 +59,8 @@ "CassNumServers": { "Description": "Number of Cass servers to start.", "Type": "Number", - "Default": "3", - "MinValue": "1" + "Default": "6", + "MinValue": "3" }, "CassInstanceType": { "Description": "Instance type for Cass servers", @@ -88,8 +88,8 @@ "ESNumServers": { "Description": "Number of ES servers to start.", "Type": "Number", - "Default": "3", - "MinValue": "1" + "Default": "6", + "MinValue": "3" }, "ESInstanceType": { "Description": "Instance type for ES servers", @@ -106,17 +106,17 @@ "SuperUserEmail": { "Description": "Email for superuser user", "Type": "String", - "Default": "[email protected]" + "Default": "[email protected]" }, "TestAdminUserEmail": { "Description": "Email for test admin user", "Type": "String", - "Default": "[email protected]" + "Default": "[email protected]" }, "NotificationEmail": { "Description": "Email for notifications", "Type": "String", - "Default": "[email protected]" + "Default": "[email protected]" }, "GraphiteInstanceType": { "Description": "Instance type for Graphite server", http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java index 4b4ded6..48af6a2 100644 --- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java +++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java @@ -126,11 +126,9 @@ public class CpSetup implements Setup { cpProps.put("collections.keyspace.strategy.class", cass.getProperties().get("cassandra.keyspace.strategy")); - cpProps.put("collections.keyspace.strategy.options", "replication_factor:" + + cpProps.put("collections.keyspace.strategy.options", cass.getProperties().get("cassandra.keyspace.replication")); - cpProps.put("cassandra.keyspace.strategy.options.replication_factor", - cass.getProperties().get("cassandra.keyspace.replication")); logger.debug("Set Cassandra properties for Core Persistence: " + cpProps.toString() ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/54772ab0/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java index 1e3b1c1..2322b95 100644 --- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java +++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java @@ -37,6 +37,7 @@ import org.apache.usergrid.persistence.IndexBucketLocator.IndexType; import org.apache.usergrid.persistence.cassandra.index.IndexBucketScanner; import org.apache.usergrid.persistence.cassandra.index.IndexScanner; import org.apache.usergrid.persistence.hector.CountingMutator; +import org.apache.usergrid.utils.MapUtils; import me.prettyprint.cassandra.connection.HConnectionManager; import me.prettyprint.cassandra.model.ConfigurableConsistencyLevel; @@ -309,6 +310,8 @@ public class CassandraService { //default read repair chance to 0.1 cfDef.setReadRepairChance( 0.1d ); + cfDef.setCompactionStrategy( "LeveledCompactionStrategy" ); + cfDef.setCompactionStrategyOptions( new MapUtils.HashMapBuilder().map("sstable_size_in_mb", "512" ) ); cluster.addColumnFamily( cfDef, true ); logger.info( "Created column family {} in keyspace {}", cfDef.getName(), keyspace );
