| 1 | 2 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,36 @@ |
| 0 |
+# |
|
| 1 |
+# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP |
|
| 2 |
+# |
|
| 3 |
+# Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 4 |
+# you may not use this file except in compliance with the License. |
|
| 5 |
+# You may obtain a copy of the License at |
|
| 6 |
+# |
|
| 7 |
+# http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 |
+# |
|
| 9 |
+# Unless required by applicable law or agreed to in writing, software |
|
| 10 |
+# distributed under the License is distributed on an "AS IS" BASIS, |
|
| 11 |
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
|
| 12 |
+# implied. |
|
| 13 |
+# See the License for the specific language governing permissions and |
|
| 14 |
+# limitations under the License. |
|
| 15 |
+# |
|
| 16 |
+ |
|
| 17 |
+# Modified from http://packages.ubuntu.com/saucy/zookeeperd |
|
| 18 |
+NAME=zookeeper |
|
| 19 |
+ZOOCFGDIR=/etc/zookeeper/conf |
|
| 20 |
+ |
|
| 21 |
+# seems, that log4j requires the log4j.properties file to be in the classpath |
|
| 22 |
+CLASSPATH="$ZOOCFGDIR:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar" |
|
| 23 |
+ |
|
| 24 |
+ZOOCFG="$ZOOCFGDIR/zoo.cfg" |
|
| 25 |
+ZOO_LOG_DIR=/var/log/zookeeper |
|
| 26 |
+USER=$NAME |
|
| 27 |
+GROUP=$NAME |
|
| 28 |
+PIDDIR=/var/run/$NAME |
|
| 29 |
+PIDFILE=$PIDDIR/$NAME.pid |
|
| 30 |
+SCRIPTNAME=/etc/init.d/$NAME |
|
| 31 |
+JAVA=/usr/bin/java |
|
| 32 |
+ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain" |
|
| 33 |
+ZOO_LOG4J_PROP="INFO,ROLLINGFILE" |
|
| 34 |
+JMXLOCALONLY=false |
|
| 35 |
+JAVA_OPTS="" |
| 0 | 36 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,69 @@ |
| 0 |
+# |
|
| 1 |
+# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP |
|
| 2 |
+# |
|
| 3 |
+# Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 4 |
+# you may not use this file except in compliance with the License. |
|
| 5 |
+# You may obtain a copy of the License at |
|
| 6 |
+# |
|
| 7 |
+# http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 |
+# |
|
| 9 |
+# Unless required by applicable law or agreed to in writing, software |
|
| 10 |
+# distributed under the License is distributed on an "AS IS" BASIS, |
|
| 11 |
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
|
| 12 |
+# implied. |
|
| 13 |
+# See the License for the specific language governing permissions and |
|
| 14 |
+# limitations under the License. |
|
| 15 |
+# |
|
| 16 |
+ |
|
| 17 |
+# From http://packages.ubuntu.com/saucy/zookeeperd |
|
| 18 |
+ |
|
| 19 |
+# ZooKeeper Logging Configuration |
|
| 20 |
+# |
|
| 21 |
+ |
|
| 22 |
+# Format is "<default threshold> (, <appender>)+ |
|
| 23 |
+ |
|
| 24 |
+log4j.rootLogger=${zookeeper.root.logger}
|
|
| 25 |
+ |
|
| 26 |
+# Example: console appender only |
|
| 27 |
+# log4j.rootLogger=INFO, CONSOLE |
|
| 28 |
+ |
|
| 29 |
+# Example with rolling log file |
|
| 30 |
+#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE |
|
| 31 |
+ |
|
| 32 |
+# Example with rolling log file and tracing |
|
| 33 |
+#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE |
|
| 34 |
+ |
|
| 35 |
+# |
|
| 36 |
+# Log INFO level and above messages to the console |
|
| 37 |
+# |
|
| 38 |
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender |
|
| 39 |
+log4j.appender.CONSOLE.Threshold=INFO |
|
| 40 |
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout |
|
| 41 |
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
|
|
| 42 |
+ |
|
| 43 |
+# |
|
| 44 |
+# Add ROLLINGFILE to rootLogger to get log file output |
|
| 45 |
+# Log DEBUG level and above messages to a log file |
|
| 46 |
+log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender |
|
| 47 |
+log4j.appender.ROLLINGFILE.Threshold=WARN |
|
| 48 |
+log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/zookeeper.log
|
|
| 49 |
+ |
|
| 50 |
+# Max log file size of 10MB |
|
| 51 |
+log4j.appender.ROLLINGFILE.MaxFileSize=10MB |
|
| 52 |
+# uncomment the next line to limit number of backup files |
|
| 53 |
+#log4j.appender.ROLLINGFILE.MaxBackupIndex=10 |
|
| 54 |
+ |
|
| 55 |
+log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout |
|
| 56 |
+log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
|
|
| 57 |
+ |
|
| 58 |
+ |
|
| 59 |
+# |
|
| 60 |
+# Add TRACEFILE to rootLogger to get log file output |
|
| 61 |
+# Log DEBUG level and above messages to a log file |
|
| 62 |
+log4j.appender.TRACEFILE=org.apache.log4j.FileAppender |
|
| 63 |
+log4j.appender.TRACEFILE.Threshold=TRACE |
|
| 64 |
+log4j.appender.TRACEFILE.File=${zookeeper.log.dir}/zookeeper_trace.log
|
|
| 65 |
+ |
|
| 66 |
+log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout |
|
| 67 |
+### Notice we are including log4j's NDC here (%x) |
|
| 68 |
+log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n
|
| 1 | 2 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,74 @@ |
| 0 |
+# |
|
| 1 |
+# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP |
|
| 2 |
+# |
|
| 3 |
+# Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 4 |
+# you may not use this file except in compliance with the License. |
|
| 5 |
+# You may obtain a copy of the License at |
|
| 6 |
+# |
|
| 7 |
+# http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 |
+# |
|
| 9 |
+# Unless required by applicable law or agreed to in writing, software |
|
| 10 |
+# distributed under the License is distributed on an "AS IS" BASIS, |
|
| 11 |
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
|
| 12 |
+# implied. |
|
| 13 |
+# See the License for the specific language governing permissions and |
|
| 14 |
+# limitations under the License. |
|
| 15 |
+# |
|
| 16 |
+# http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html |
|
| 17 |
+ |
|
| 18 |
+# The number of milliseconds of each tick |
|
| 19 |
+tickTime=2000 |
|
| 20 |
+# The number of ticks that the initial |
|
| 21 |
+# synchronization phase can take |
|
| 22 |
+initLimit=10 |
|
| 23 |
+# The number of ticks that can pass between |
|
| 24 |
+# sending a request and getting an acknowledgement |
|
| 25 |
+syncLimit=5 |
|
| 26 |
+# the directory where the snapshot is stored. |
|
| 27 |
+dataDir=/var/lib/zookeeper |
|
| 28 |
+# Place the dataLogDir to a separate physical disc for better performance |
|
| 29 |
+# dataLogDir=/disk2/zookeeper |
|
| 30 |
+ |
|
| 31 |
+# the port at which the clients will connect |
|
| 32 |
+clientPort=2181 |
|
| 33 |
+ |
|
| 34 |
+# Maximum number of clients that can connect from one client |
|
| 35 |
+maxClientCnxns=60 |
|
| 36 |
+ |
|
| 37 |
+# specify all zookeeper servers |
|
| 38 |
+# The fist port is used by followers to connect to the leader |
|
| 39 |
+# The second one is used for leader election |
|
| 40 |
+ |
|
| 41 |
+server.0=127.0.0.1:2888:3888 |
|
| 42 |
+ |
|
| 43 |
+# To avoid seeks ZooKeeper allocates space in the transaction log file in |
|
| 44 |
+# blocks of preAllocSize kilobytes. The default block size is 64M. One reason |
|
| 45 |
+# for changing the size of the blocks is to reduce the block size if snapshots |
|
| 46 |
+# are taken more often. (Also, see snapCount). |
|
| 47 |
+#preAllocSize=65536 |
|
| 48 |
+ |
|
| 49 |
+# Clients can submit requests faster than ZooKeeper can process them, |
|
| 50 |
+# especially if there are a lot of clients. To prevent ZooKeeper from running |
|
| 51 |
+# out of memory due to queued requests, ZooKeeper will throttle clients so that |
|
| 52 |
+# there is no more than globalOutstandingLimit outstanding requests in the |
|
| 53 |
+# system. The default limit is 1,000.ZooKeeper logs transactions to a |
|
| 54 |
+# transaction log. After snapCount transactions are written to a log file a |
|
| 55 |
+# snapshot is started and a new transaction log file is started. The default |
|
| 56 |
+# snapCount is 10,000. |
|
| 57 |
+#snapCount=1000 |
|
| 58 |
+ |
|
| 59 |
+# If this option is defined, requests will be will logged to a trace file named |
|
| 60 |
+# traceFile.year.month.day. |
|
| 61 |
+#traceFile= |
|
| 62 |
+ |
|
| 63 |
+# Leader accepts client connections. Default value is "yes". The leader machine |
|
| 64 |
+# coordinates updates. For higher update throughput at thes slight expense of |
|
| 65 |
+# read throughput the leader can be configured to not accept clients and focus |
|
| 66 |
+# on coordination. |
|
| 67 |
+#leaderServes=yes |
|
| 68 |
+ |
|
| 69 |
+# Autopurge every hour to avoid using lots of disk in bursts |
|
| 70 |
+# Order of the next 2 properties matters. |
|
| 71 |
+# autopurge.snapRetainCount must be before autopurge.purgeInterval. |
|
| 72 |
+autopurge.snapRetainCount=3 |
|
| 73 |
+autopurge.purgeInterval=1 |
|
| 0 | 74 |
\ No newline at end of file |
| 1 | 75 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,86 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+# |
|
| 2 |
+# lib/zookeeper |
|
| 3 |
+# Functions to control the installation and configuration of **zookeeper** |
|
| 4 |
+ |
|
| 5 |
+# Dependencies: |
|
| 6 |
+# |
|
| 7 |
+# - ``functions`` file |
|
| 8 |
+ |
|
| 9 |
+# ``stack.sh`` calls the entry points in this order: |
|
| 10 |
+# |
|
| 11 |
+# - is_zookeeper_enabled |
|
| 12 |
+# - install_zookeeper |
|
| 13 |
+# - configure_zookeeper |
|
| 14 |
+# - init_zookeeper |
|
| 15 |
+# - start_zookeeper |
|
| 16 |
+# - stop_zookeeper |
|
| 17 |
+# - cleanup_zookeeper |
|
| 18 |
+ |
|
| 19 |
+# Save trace setting |
|
| 20 |
+XTRACE=$(set +o | grep xtrace) |
|
| 21 |
+set +o xtrace |
|
| 22 |
+ |
|
| 23 |
+ |
|
| 24 |
+# Defaults |
|
| 25 |
+# -------- |
|
| 26 |
+ |
|
| 27 |
+# <define global variables here that belong to this project> |
|
| 28 |
+ |
|
| 29 |
+# Set up default directories |
|
| 30 |
+ZOOKEEPER_DATA_DIR=$DEST/data/zookeeper |
|
| 31 |
+ZOOKEEPER_CONF_DIR=/etc/zookeeper |
|
| 32 |
+ |
|
| 33 |
+ |
|
| 34 |
+# Entry Points |
|
| 35 |
+# ------------ |
|
| 36 |
+ |
|
| 37 |
+# Test if any zookeeper service us enabled |
|
| 38 |
+# is_zookeeper_enabled |
|
| 39 |
+function is_zookeeper_enabled {
|
|
| 40 |
+ [[ ,${ENABLED_SERVICES}, =~ ,"zookeeper", ]] && return 0
|
|
| 41 |
+ return 1 |
|
| 42 |
+} |
|
| 43 |
+ |
|
| 44 |
+# cleanup_zookeeper() - Remove residual data files, anything left over from previous |
|
| 45 |
+# runs that a clean run would need to clean up |
|
| 46 |
+function cleanup_zookeeper {
|
|
| 47 |
+ sudo rm -rf $ZOOKEEPER_DATA_DIR |
|
| 48 |
+} |
|
| 49 |
+ |
|
| 50 |
+# configure_zookeeper() - Set config files, create data dirs, etc |
|
| 51 |
+function configure_zookeeper {
|
|
| 52 |
+ sudo cp $FILES/zookeeper/* $ZOOKEEPER_CONF_DIR |
|
| 53 |
+ sudo sed -i -e 's|.*dataDir.*|dataDir='$ZOOKEEPER_DATA_DIR'|' $ZOOKEEPER_CONF_DIR/zoo.cfg |
|
| 54 |
+} |
|
| 55 |
+ |
|
| 56 |
+# init_zookeeper() - Initialize databases, etc. |
|
| 57 |
+function init_zookeeper {
|
|
| 58 |
+ # clean up from previous (possibly aborted) runs |
|
| 59 |
+ # create required data files |
|
| 60 |
+ sudo rm -rf $ZOOKEEPER_DATA_DIR |
|
| 61 |
+ sudo mkdir -p $ZOOKEEPER_DATA_DIR |
|
| 62 |
+} |
|
| 63 |
+ |
|
| 64 |
+# install_zookeeper() - Collect source and prepare |
|
| 65 |
+function install_zookeeper {
|
|
| 66 |
+ install_package zookeeperd |
|
| 67 |
+} |
|
| 68 |
+ |
|
| 69 |
+# start_zookeeper() - Start running processes, including screen |
|
| 70 |
+function start_zookeeper {
|
|
| 71 |
+ start_service zookeeper |
|
| 72 |
+} |
|
| 73 |
+ |
|
| 74 |
+# stop_zookeeper() - Stop running processes (non-screen) |
|
| 75 |
+function stop_zookeeper {
|
|
| 76 |
+ stop_service zookeeper |
|
| 77 |
+} |
|
| 78 |
+ |
|
| 79 |
+# Restore xtrace |
|
| 80 |
+$XTRACE |
|
| 81 |
+ |
|
| 82 |
+# Tell emacs to use shell-script-mode |
|
| 83 |
+## Local variables: |
|
| 84 |
+## mode: shell-script |
|
| 85 |
+## End: |
| ... | ... |
@@ -539,6 +539,7 @@ source $TOP_DIR/lib/heat |
| 539 | 539 |
source $TOP_DIR/lib/neutron-legacy |
| 540 | 540 |
source $TOP_DIR/lib/ldap |
| 541 | 541 |
source $TOP_DIR/lib/dstat |
| 542 |
+source $TOP_DIR/lib/zookeeper |
|
| 542 | 543 |
|
| 543 | 544 |
# Extras Source |
| 544 | 545 |
# -------------- |
| ... | ... |
@@ -723,6 +724,11 @@ run_phase stack pre-install |
| 723 | 723 |
|
| 724 | 724 |
install_rpc_backend |
| 725 | 725 |
|
| 726 |
+if is_service_enabled zookeeper; then |
|
| 727 |
+ cleanup_zookeeper |
|
| 728 |
+ configure_zookeeper |
|
| 729 |
+ init_zookeeper |
|
| 730 |
+fi |
|
| 726 | 731 |
if is_service_enabled $DATABASE_BACKENDS; then |
| 727 | 732 |
install_database |
| 728 | 733 |
fi |
| ... | ... |
@@ -962,6 +968,15 @@ save_stackenv $LINENO |
| 962 | 962 |
start_dstat |
| 963 | 963 |
|
| 964 | 964 |
|
| 965 |
+# Zookeeper |
|
| 966 |
+# ----- |
|
| 967 |
+ |
|
| 968 |
+# zookeeper for use with tooz for Distributed Lock Management capabilities etc., |
|
| 969 |
+if is_service_enabled zookeeper; then |
|
| 970 |
+ start_zookeeper |
|
| 971 |
+fi |
|
| 972 |
+ |
|
| 973 |
+ |
|
| 965 | 974 |
# Keystone |
| 966 | 975 |
# -------- |
| 967 | 976 |
|
| ... | ... |
@@ -69,7 +69,7 @@ if ! isset ENABLED_SERVICES ; then |
| 69 | 69 |
# Dashboard |
| 70 | 70 |
ENABLED_SERVICES+=,horizon |
| 71 | 71 |
# Additional services |
| 72 |
- ENABLED_SERVICES+=,rabbit,tempest,mysql,dstat |
|
| 72 |
+ ENABLED_SERVICES+=,rabbit,tempest,mysql,dstat,zookeeper |
|
| 73 | 73 |
fi |
| 74 | 74 |
|
| 75 | 75 |
# SQLAlchemy supports multiple database drivers for each database server |
| ... | ... |
@@ -69,6 +69,7 @@ source $TOP_DIR/lib/heat |
| 69 | 69 |
source $TOP_DIR/lib/neutron-legacy |
| 70 | 70 |
source $TOP_DIR/lib/ldap |
| 71 | 71 |
source $TOP_DIR/lib/dstat |
| 72 |
+source $TOP_DIR/lib/zookeeper |
|
| 72 | 73 |
|
| 73 | 74 |
# Extras Source |
| 74 | 75 |
# -------------- |
| ... | ... |
@@ -172,6 +173,10 @@ if is_service_enabled dstat; then |
| 172 | 172 |
stop_dstat |
| 173 | 173 |
fi |
| 174 | 174 |
|
| 175 |
+if is_service_enabled zookeeper; then |
|
| 176 |
+ stop_zookeeper |
|
| 177 |
+fi |
|
| 178 |
+ |
|
| 175 | 179 |
# Clean up the remainder of the screen processes |
| 176 | 180 |
SCREEN=$(which screen) |
| 177 | 181 |
if [[ -n "$SCREEN" ]]; then |