Yingyi Bu has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1525
Change subject: Ansible scripts for cluster installtion.
......................................................................
Ansible scripts for cluster installtion.
- This change refactored aws scripts and share
the common part with non-aws cluster installation.
Change-Id: I310f6f198c9ce41d7d7667dc4fbc21b3e34a77ab
---
M
asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
M asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
A asterixdb/asterix-server/src/main/opt/ansible/bin/deploy.sh
A asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
A asterixdb/asterix-server/src/main/opt/ansible/bin/start.sh
A asterixdb/asterix-server/src/main/opt/ansible/bin/stop.sh
A asterixdb/asterix-server/src/main/opt/ansible/conf/cc.conf
A asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
A asterixdb/asterix-server/src/main/opt/ansible/conf/nodes
A asterixdb/asterix-server/src/main/opt/ansible/conf/user
A asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/erase.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/erase_all.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/gen_conf.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_start.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/start_nc.yml
A asterixdb/asterix-server/src/main/opt/ansible/yaml/wait_ssh.yml
D asterixdb/asterix-server/src/main/opt/aws/ansible/instance_start.yml
M asterixdb/asterix-server/src/main/opt/aws/bin/start.sh
M asterixdb/asterix-server/src/main/opt/aws/bin/stop.sh
R asterixdb/asterix-server/src/main/opt/aws/yaml/aws_start.yml
R asterixdb/asterix-server/src/main/opt/aws/yaml/aws_stop.yml
A asterixdb/asterix-server/src/main/opt/aws/yaml/install_jdk.yml
A asterixdb/asterix-server/src/main/opt/aws/yaml/instance_start.yml
27 files changed, 597 insertions(+), 86 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/25/1525/1
diff --git
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index ce57648..acfec80 100644
---
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -18,6 +18,12 @@
*/
package org.apache.asterix.hyracks.bootstrap;
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import org.apache.asterix.app.nc.NCAppRuntimeContext;
import org.apache.asterix.app.replication.message.StartupTaskRequestMessage;
import org.apache.asterix.common.api.AsterixThreadFactory;
@@ -47,12 +53,6 @@
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
public class NCApplicationEntryPoint implements INCApplicationEntryPoint {
private static final Logger LOGGER =
Logger.getLogger(NCApplicationEntryPoint.class.getName());
diff --git a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
index 48aa168..e894ba7 100644
--- a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
+++ b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
@@ -52,6 +52,18 @@
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
+ <directory>src/main/opt/ansible/yaml</directory>
+ <outputDirectory>opt/aws/yaml</outputDirectory>
+ <includes>
+ <include>**/*.yml</include>
+ </includes>
+ <excludes>
+ <exclude>**/instance_start.yml</exclude>
+ <exclude>**/gen_conf.yml</exclude>
+ </excludes>
+ <filtered>true</filtered>
+ </fileSet>
+ <fileSet>
<directory>target/appassembler/repo</directory>
<outputDirectory>repo</outputDirectory>
</fileSet>
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/bin/deploy.sh
b/asterixdb/asterix-server/src/main/opt/ansible/bin/deploy.sh
new file mode 100644
index 0000000..1df67af
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/bin/deploy.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+# Gets the absolute path so that the script can work no matter where it is
invoked.
+pushd `dirname $0` > /dev/null
+SCRIPT_PATH=`pwd -P`
+popd > /dev/null
+ANSB_PATH=`dirname "${SCRIPT_PATH}"`
+
+$inventory=$ANSB_PATH/conf/nodes
+
+# Deploy asterixdb on all nodes.
+export ANSIBLE_HOST_KEY_CHECKING=false
+ansible-playbook -i $inventory $ANSB_PATH/yaml/deploy_all.yml
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
b/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
new file mode 100644
index 0000000..1df67af
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/bin/erase.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+# Gets the absolute path so that the script can work no matter where it is
invoked.
+pushd `dirname $0` > /dev/null
+SCRIPT_PATH=`pwd -P`
+popd > /dev/null
+ANSB_PATH=`dirname "${SCRIPT_PATH}"`
+
+$inventory=$ANSB_PATH/conf/nodes
+
+# Deploy asterixdb on all nodes.
+export ANSIBLE_HOST_KEY_CHECKING=false
+ansible-playbook -i $inventory $ANSB_PATH/yaml/deploy_all.yml
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/bin/start.sh
b/asterixdb/asterix-server/src/main/opt/ansible/bin/start.sh
new file mode 100755
index 0000000..4016e78
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/bin/start.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+# Gets the absolute path so that the script can work no matter where it is
invoked.
+pushd `dirname $0` > /dev/null
+SCRIPT_PATH=`pwd -P`
+popd > /dev/null
+ANSB_PATH=`dirname "${SCRIPT_PATH}"`
+
+$inventory=$ANSB_PATH/conf/nodes
+
+# Deploy asterixdb on all nodes.
+export ANSIBLE_HOST_KEY_CHECKING=false
+ansible-playbook -i $inventory $ANSB_PATH/yaml/erase.yml
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/bin/stop.sh
b/asterixdb/asterix-server/src/main/opt/ansible/bin/stop.sh
new file mode 100755
index 0000000..c935827
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/bin/stop.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+
+# Gets the absolute path so that the script can work no matter where it is
invoked.
+pushd `dirname $0` > /dev/null
+SCRIPT_PATH=`pwd -P`
+popd > /dev/null
+ANSB_PATH=`dirname "${SCRIPT_PATH}"`
+
+$inventory=$ANSB_PATH/conf/nodes
+
+# Starts asterixdb on all AWS instances.
+export ANSIBLE_HOST_KEY_CHECKING=false
+ansible-playbook -i $inventory $ANSB_PATH/yaml/instance_stop.yml
+
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/conf/cc.conf
b/asterixdb/asterix-server/src/main/opt/ansible/conf/cc.conf
new file mode 100644
index 0000000..7f93969
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/conf/cc.conf
@@ -0,0 +1,23 @@
+; 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.
+
+[app]
+log.level=WARNING
+
+[nc]
+txnlogdir=txnlog
+iodevices=iodevice
diff --git
a/asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
b/asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
new file mode 100644
index 0000000..2c56693
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/conf/instance_settings.yml
@@ -0,0 +1,45 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+# The name of the product (or extension) being used.
+product: asterixdb
+
+# The script that starts a nc service.
+ncsbin: "asterixncservice"
+
+# The script that starts a nc.
+ncbin: "asterixnc"
+
+# The script that starts a cc.
+ccbin: "asterixcc"
+
+# The parent directory for the working directory.
+basedir: /home/$USER
+
+# The working directory.
+binarydir: "{{ basedir }}/{{ product }}"
+
+# The full binary distribution directory.
+dist: "../../../../"
+
+# The nc service command (script).
+ncservice: "{{ binarydir}}/bin/{{ ncsbin }}"
+
+# The cc service command (script).
+cc: "{{ binarydir}}/bin/{{ ccbin }}"
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/conf/nodes
b/asterixdb/asterix-server/src/main/opt/ansible/conf/nodes
new file mode 100644
index 0000000..70b8bcc
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/conf/nodes
@@ -0,0 +1,22 @@
+; 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.
+
+[cc]
+localhost
+
+[ncs]
+localhost
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/conf/user
b/asterixdb/asterix-server/src/main/opt/ansible/conf/user
new file mode 100644
index 0000000..45e57c9
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/conf/user
@@ -0,0 +1,18 @@
+; 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.
+
+ansible_ssh_user=$USER
\ No newline at end of file
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
new file mode 100644
index 0000000..ff06614
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy.yml
@@ -0,0 +1,29 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- name: Deploy binaries
+ synchronize:
+ src: "{{ dist }}"
+ dest: "{{ binarydir }}"
+ archive: true
+
+- name: Ensure the log directory exists
+ file:
+ path: "{{ binarydir }}/logs"
+ state: directory
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
new file mode 100644
index 0000000..f456bf3
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/deploy_all.yml
@@ -0,0 +1,22 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- hosts: all
+ tasks:
+ - include: depoly.yml
\ No newline at end of file
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/erase.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/erase.yml
new file mode 100644
index 0000000..3586c88
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/erase.yml
@@ -0,0 +1,23 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- name: Ensure the log directory exists
+ file:
+ path: "{{ binarydir }}"
+ state: absent
\ No newline at end of file
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/erase_all.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/erase_all.yml
new file mode 100644
index 0000000..41d807a
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/erase_all.yml
@@ -0,0 +1,22 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- hosts: all
+ tasks:
+ - include: erase.yml
\ No newline at end of file
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/gen_conf.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/gen_conf.yml
new file mode 100644
index 0000000..a5d80dc
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/gen_conf.yml
@@ -0,0 +1,33 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- name: Generate the cluster configuration file
+ shell: cp ../conf/cc.conf "{{ ccconf }}"
+
+- name: Populate NCs to the cluster configuration file
+ shell: printf "[nc/{{ node.0 + start }}]\naddress={{ node.1 }}\n\n" >> "{{
ccconf }}"
+ with_indexed_items: "{{ groups['ncs'] }}"
+ loop_control:
+ loop_var: node
+
+- name: Populate CC to the cluster configuration file "{{ ccconf }}"
+ shell: printf "[cc]\ncluster.address={{ groups['cc'][0] }}\n\n" > "{{ ccconf
}}"
+
+- name: Populate the NC command to the cluster configuration file {{ ccconf }}
+ shell: printf "command={{ ncbin }}\n" >> "{{ ccconf }}"
diff --git
a/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_start.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_start.yml
new file mode 100644
index 0000000..acd550c
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_start.yml
@@ -0,0 +1,39 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- hosts: [localhost,]
+ tasks:
+ - include: wait_ssh.yml
+
+ - include_vars: ../conf/instance_settings.yml
+
+ - include: gen_conf.yml
+
+- hosts: ncs
+ tasks:
+ - include_vars: ../conf/instance_settings.yml
+
+ - include: start_nc.yml
+
+- hosts: cc
+ tasks:
+ - include_vars: ../conf/instance_settings.yml
+
+ - include: start_cc.yml
+
diff --git
a/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
new file mode 100644
index 0000000..825f7bf
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/instance_stop.yml
@@ -0,0 +1,24 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- hosts: all
+ tasks:
+ - name: Stop the CC and NCs
+ shell: kill -9 `jps | egrep '(CDriver|NCService)' | awk '{print $1}'`
+
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
new file mode 100644
index 0000000..539e434
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_cc.yml
@@ -0,0 +1,31 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- name: Copy cluster config to CC
+ synchronize:
+ src: /tmp/asterixdb/cc.conf
+ dest: "{{ basedir }}/cc.conf"
+
+- name: Update cluster config
+ shell: find -P "{{ basedir }}/cc.conf"|xargs perl -pi -e
's|command=asterixnc|command={{ ncbin }}|g'
+
+- name: Start CC
+ shell: nohup "{{ cc }}" -config-file "{{ basedir }}/cc.conf" &> "{{
binarydir }}/logs/cc.log" &
+ async: 10
+ poll: 0
\ No newline at end of file
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_nc.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_nc.yml
new file mode 100644
index 0000000..15a50b8
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/start_nc.yml
@@ -0,0 +1,23 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- name: Start NC Service
+ shell: nohup "{{ ncservice }}" &> "{{ binarydir }}/logs/ncservice.log" &
+ async: 10
+ poll: 0
\ No newline at end of file
diff --git a/asterixdb/asterix-server/src/main/opt/ansible/yaml/wait_ssh.yml
b/asterixdb/asterix-server/src/main/opt/ansible/yaml/wait_ssh.yml
new file mode 100644
index 0000000..1e58cc7
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/ansible/yaml/wait_ssh.yml
@@ -0,0 +1,26 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- name: Wait for SSH to come up at the cluster controller
+ wait_for: host="{{ item }}" port=22 search_regex=OpenSSH delay=0
timeout=300 state=started
+ with_items: "{{ groups['cc'] }}"
+
+- name: Wait for SSH to come up at node controllers
+ wait_for: host="{{ item }}" port=22 search_regex=OpenSSH delay=0
timeout=300 state=started
+ with_items: "{{ groups['ncs'] }}"
diff --git
a/asterixdb/asterix-server/src/main/opt/aws/ansible/instance_start.yml
b/asterixdb/asterix-server/src/main/opt/aws/ansible/instance_start.yml
deleted file mode 100644
index e71066c..0000000
--- a/asterixdb/asterix-server/src/main/opt/aws/ansible/instance_start.yml
+++ /dev/null
@@ -1,73 +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.
-# ------------------------------------------------------------
-
-- hosts: all
- tasks:
- - include_vars: ../conf/instance_settings.yml
-
- - name: Download JDK
- shell: "wget -q --tries=5 --no-cookies --no-check-certificate --header \
- \"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup-cookie\" \
-
\"http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm\""
-
- - name: Install JDK
- shell: sudo yum -y localinstall jdk-8u121-linux-x64.rpm
-
- - name: Deploy binaries
- synchronize:
- src: "{{ dist }}"
- dest: "{{ binarydir }}"
- archive: true
-
- - name: Ensure the log directory exists
- file:
- path: "{{ binarydir }}/logs"
- state: directory
-
-- hosts: ncs
- tasks:
- - include_vars: ../conf/instance_settings.yml
-
-
- - name: Ensure the io device directory exit
- file:
- path: "{{ basedir }}/iodevice"
- state: directory
-
- - name: Start NC Service
- shell: nohup "{{ ncservice }}" &> "{{ binarydir }}/logs/ncservice.log" &
- async: 10
- poll: 0
-
-- hosts: cc
- tasks:
- - include_vars: ../conf/instance_settings.yml
-
- - name: Copy cluster config to CC
- synchronize:
- src: /tmp/asterixdb/cc.conf
- dest: "{{ basedir }}/cc.conf"
-
- - name: Update cluster config
- shell: find -P "{{ basedir }}/cc.conf"|xargs perl -pi -e
's|command=asterixnc|command={{ ncbin }}|g'
-
- - name: Start CC
- shell: nohup "{{ cc }}" -config-file "{{ basedir }}/cc.conf" &> "{{
binarydir }}/logs/cc.log" &
- async: 10
- poll: 0
diff --git a/asterixdb/asterix-server/src/main/opt/aws/bin/start.sh
b/asterixdb/asterix-server/src/main/opt/aws/bin/start.sh
index 2627a09..a836b4e 100755
--- a/asterixdb/asterix-server/src/main/opt/aws/bin/start.sh
+++ b/asterixdb/asterix-server/src/main/opt/aws/bin/start.sh
@@ -27,7 +27,7 @@
DIST_PATH=`dirname "${OPT_PATH}"`
# Starts an AWS cluster.
-ansible-playbook -i "localhost," $AWS_PATH/ansible/aws_start.yml
+ansible-playbook -i "localhost," $AWS_PATH/yaml/aws_start.yml
# Generates an Ansible inventory file and an AsterixDB configuration file.
temp=/tmp/asterixdb
@@ -35,5 +35,5 @@
# Installs asterixdb on all AWS instances.
export ANSIBLE_HOST_KEY_CHECKING=false
-ansible-playbook -i $inventory $AWS_PATH/ansible/instance_start.yml
+ansible-playbook -i $inventory $AWS_PATH/yaml/instance_start.yml
diff --git a/asterixdb/asterix-server/src/main/opt/aws/bin/stop.sh
b/asterixdb/asterix-server/src/main/opt/aws/bin/stop.sh
index 0f8bf98..48f4ff7 100755
--- a/asterixdb/asterix-server/src/main/opt/aws/bin/stop.sh
+++ b/asterixdb/asterix-server/src/main/opt/aws/bin/stop.sh
@@ -25,4 +25,4 @@
AWS_PATH=`dirname "${SCRIPT_PATH}"`
# Terminates an AWS cluster.
-ansible-playbook -i "localhost," $AWS_PATH/ansible/aws_stop.yml
+ansible-playbook -i "localhost," $AWS_PATH/yaml/aws_stop.yml
diff --git a/asterixdb/asterix-server/src/main/opt/aws/ansible/aws_start.yml
b/asterixdb/asterix-server/src/main/opt/aws/yaml/aws_start.yml
similarity index 95%
rename from asterixdb/asterix-server/src/main/opt/aws/ansible/aws_start.yml
rename to asterixdb/asterix-server/src/main/opt/aws/yaml/aws_start.yml
index 645f68f..48c7c4a 100644
--- a/asterixdb/asterix-server/src/main/opt/aws/ansible/aws_start.yml
+++ b/asterixdb/asterix-server/src/main/opt/aws/yaml/aws_start.yml
@@ -102,7 +102,3 @@
- name: Populate the NC command to the cluster configuration file {{
ccconf }}
shell: printf "command=asterixnc\n" >> "{{ ccconf }}"
-
- - name: Wait for SSH to come up
- wait_for: host="{{ item.public_ip }}" port=22 search_regex=OpenSSH
delay=0 timeout=300 state=started
- with_items: "{{ ec2.instances }}"
diff --git a/asterixdb/asterix-server/src/main/opt/aws/ansible/aws_stop.yml
b/asterixdb/asterix-server/src/main/opt/aws/yaml/aws_stop.yml
similarity index 100%
rename from asterixdb/asterix-server/src/main/opt/aws/ansible/aws_stop.yml
rename to asterixdb/asterix-server/src/main/opt/aws/yaml/aws_stop.yml
diff --git a/asterixdb/asterix-server/src/main/opt/aws/yaml/install_jdk.yml
b/asterixdb/asterix-server/src/main/opt/aws/yaml/install_jdk.yml
new file mode 100644
index 0000000..05838bd
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/aws/yaml/install_jdk.yml
@@ -0,0 +1,26 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+- name: Download JDK
+ shell: "wget -q --tries=5 --no-cookies --no-check-certificate --header \
+ \"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup-cookie\" \
+
\"http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm\""
+
+- name: Install JDK
+ shell: sudo yum -y localinstall jdk-8u121-linux-x64.rpm
diff --git a/asterixdb/asterix-server/src/main/opt/aws/yaml/instance_start.yml
b/asterixdb/asterix-server/src/main/opt/aws/yaml/instance_start.yml
new file mode 100644
index 0000000..6762c12
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/opt/aws/yaml/instance_start.yml
@@ -0,0 +1,44 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+
+- hosts: [localhost,]
+ tasks:
+ - include: wait_ssh.yml
+
+- hosts: all
+ tasks:
+ - include: install_jdk.yml
+
+ - include_vars: ../conf/instance_settings.yml
+
+ - include: deploy.yml
+
+- hosts: ncs
+ tasks:
+ - include_vars: ../conf/instance_settings.yml
+
+ - include: start_nc.yml
+
+- hosts: cc
+ tasks:
+ - include_vars: ../conf/instance_settings.yml
+
+ - include: start_cc.yml
+
--
To view, visit https://asterix-gerrit.ics.uci.edu/1525
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I310f6f198c9ce41d7d7667dc4fbc21b3e34a77ab
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <[email protected]>