http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zoo.cfg.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zoo.cfg.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zoo.cfg.xml new file mode 100644 index 0000000..c3ba734 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zoo.cfg.xml @@ -0,0 +1,87 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> +<!-- +/** + * 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. + */ +--> + +<configuration> + <property> + <name>tickTime</name> + <value>2000</value> + <display-name>Length of single Tick</display-name> + <description>The length of a single tick in milliseconds, which is the basic time unit used by ZooKeeper</description> + <value-attributes> + <type>int</type> + <overridable>false</overridable> + <unit>ms</unit> + </value-attributes> + </property> + <property> + <name>initLimit</name> + <value>10</value> + <display-name>Ticks to allow for sync at Init</display-name> + <description>Ticks to allow for sync at Init.</description> + <value-attributes> + <type>int</type> + <overridable>false</overridable> + </value-attributes> + </property> + <property> + <name>syncLimit</name> + <value>5</value> + <display-name>Ticks to allow for sync at Runtime</display-name> + <description>Ticks to allow for sync at Runtime.</description> + <value-attributes> + <type>int</type> + <overridable>false</overridable> + </value-attributes> + </property> + <property> + <name>clientPort</name> + <value>2181</value> + <display-name>Port for running ZK Server</display-name> + <description>Port for running ZK Server.</description> + <value-attributes> + <type>int</type> + <overridable>false</overridable> + </value-attributes> + </property> + <property> + <name>dataDir</name> + <value>/hadoop/zookeeper</value> + <display-name>ZooKeeper directory</display-name> + <description>Data directory for ZooKeeper.</description> + <value-attributes> + <type>directory</type> + </value-attributes> + </property> + <property> + <name>autopurge.snapRetainCount</name> + <value>30</value> + <description>ZooKeeper purge feature retains the autopurge.snapRetainCount + most recent snapshots and the corresponding transaction + logs in the dataDir and dataLogDir respectively and deletes the rest. </description> + </property> + <property> + <name>autopurge.purgeInterval</name> + <value>24</value> + <description>The time interval in hours for which the purge task has to be triggered. + Set to a positive integer (1 and above) to enable the auto purging.</description> + </property> +</configuration> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-env.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-env.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-env.xml new file mode 100644 index 0000000..3b5141a --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-env.xml @@ -0,0 +1,102 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> +<!-- +/** + * 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. + */ +--> + +<configuration supports_adding_forbidden="true"> + <property> + <name>zk_user</name> + <display-name>ZooKeeper User</display-name> + <value>zookeeper</value> + <property-type>USER</property-type> + <description>ZooKeeper User.</description> + <value-attributes> + <type>user</type> + <overridable>false</overridable> + </value-attributes> + </property> + <property> + <name>zk_log_dir</name> + <value>/var/log/zookeeper</value> + <display-name>ZooKeeper Log Dir</display-name> + <description>ZooKeeper Log Dir</description> + <value-attributes> + <type>directory</type> + <overridable>false</overridable> + </value-attributes> + </property> + <property> + <name>zk_pid_dir</name> + <value>/var/run/zookeeper</value> + <display-name>ZooKeeper PID Dir</display-name> + <description>ZooKeeper Pid Dir</description> + <value-attributes> + <type>directory</type> + <overridable>false</overridable> + <editable-only-at-install>true</editable-only-at-install> + </value-attributes> + </property> + <property> + <name>zk_server_heapsize</name> + <value>1024</value> + <description>Maximum amount of memory each Zookeeper Server can use.</description> + <display-name>Zookeeper Server Maximum Memory</display-name> + <value-attributes> + <type>int</type> + <minimum>256</minimum> + <maximum>32768</maximum> + <unit>MB</unit> + <increment-step>256</increment-step> + </value-attributes> + </property> + <property> + <name>zookeeper_principal_name</name> + <description>ZooKeeper principal name</description> + </property> + + <property> + <name>zookeeper_keytab_path</name> + <description>ZooKeeper keytab path</description> + </property> + + + <!-- zookeeper-env.sh --> + <property> + <name>content</name> + <description>This is the jinja template for zookeeper-env.sh file</description> + <value> +export JAVA_HOME={{java64_home}} +export ZOOKEEPER_HOME={{zk_home}} +export ZOO_LOG_DIR={{zk_log_dir}} +export ZOOPIDFILE={{zk_pid_file}} +export SERVER_JVMFLAGS={{zk_server_heapsize}} +export JAVA=$JAVA_HOME/bin/java +export CLASSPATH=$CLASSPATH:/usr/share/zookeeper/* + +{% if security_enabled %} +export SERVER_JVMFLAGS="$SERVER_JVMFLAGS -Djava.security.auth.login.config={{zk_server_jaas_file}}" +export CLIENT_JVMFLAGS="$CLIENT_JVMFLAGS -Djava.security.auth.login.config={{zk_client_jaas_file}}" +{% endif %} + </value> + <value-attributes> + <type>content</type> + </value-attributes> + </property> +</configuration> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-log4j.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-log4j.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-log4j.xml new file mode 100644 index 0000000..ede4630 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-log4j.xml @@ -0,0 +1,105 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> +<!-- +/** + * 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. + */ +--> + +<configuration supports_final="false" supports_adding_forbidden="true"> + + <property> + <name>content</name> + <description>Custom log4j.properties</description> + <value> +# +# +# 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. +# +# +# + +# +# ZooKeeper Logging Configuration +# + +# DEFAULT: console appender only +log4j.rootLogger=INFO, CONSOLE + +# Example with rolling log file +#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE + +# Example with rolling log file and tracing +#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE + +# +# Log INFO level and above messages to the console +# +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.Threshold=INFO +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n + +# +# Add ROLLINGFILE to rootLogger to get log file output +# Log DEBUG level and above messages to a log file +log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender +log4j.appender.ROLLINGFILE.Threshold=DEBUG +log4j.appender.ROLLINGFILE.File=zookeeper.log + +# Max log file size of 10MB +log4j.appender.ROLLINGFILE.MaxFileSize=10MB +# uncomment the next line to limit number of backup files +#log4j.appender.ROLLINGFILE.MaxBackupIndex=10 + +log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout +log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n + + +# +# Add TRACEFILE to rootLogger to get log file output +# Log DEBUG level and above messages to a log file +log4j.appender.TRACEFILE=org.apache.log4j.FileAppender +log4j.appender.TRACEFILE.Threshold=TRACE +log4j.appender.TRACEFILE.File=zookeeper_trace.log + +log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout +### Notice we are including log4j's NDC here (%x) +log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n + </value> + <value-attributes> + <type>content</type> + <show-property-name>false</show-property-name> + </value-attributes> + </property> + +</configuration> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/kerberos.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/kerberos.json b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/kerberos.json new file mode 100644 index 0000000..0a64ea5 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/kerberos.json @@ -0,0 +1,39 @@ +{ + "services": [ + { + "name": "ZOOKEEPER", + "identities": [ + { + "name": "/smokeuser" + } + ], + "components": [ + { + "name": "ZOOKEEPER_SERVER", + "identities": [ + { + "name": "zookeeper_zk", + "principal": { + "value": "zookeeper/_HOST@${realm}", + "type" : "service", + "configuration": "zookeeper-env/zookeeper_principal_name" + }, + "keytab": { + "file": "${keytab_dir}/zk.service.keytab", + "owner": { + "name": "${zookeeper-env/zk_user}", + "access": "r" + }, + "group": { + "name": "${cluster-env/user_group}", + "access": "" + }, + "configuration": "zookeeper-env/zookeeper_keytab_path" + } + } + ] + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/metainfo.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/metainfo.xml new file mode 100644 index 0000000..bff62bd --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/metainfo.xml @@ -0,0 +1,97 @@ +<?xml version="1.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. +--> +<metainfo> + <schemaVersion>2.0</schemaVersion> + <services> + <service> + <name>ZOOKEEPER</name> + <displayName>ZooKeeper</displayName> + <comment>Centralized service which provides highly reliable distributed coordination</comment> + <version>3.4.5</version> + <components> + + <component> + <name>ZOOKEEPER_SERVER</name> + <displayName>ZooKeeper Server</displayName> + <category>MASTER</category> + <cardinality>1+</cardinality> + <versionAdvertised>true</versionAdvertised> + <commandScript> + <script>scripts/zookeeper_server.py</script> + <scriptType>PYTHON</scriptType> + <timeout>1200</timeout> + </commandScript> + <logs> + <log> + <logId>zookeeper</logId> + <primary>true</primary> + </log> + </logs> + </component> + + <component> + <name>ZOOKEEPER_CLIENT</name> + <displayName>ZooKeeper Client</displayName> + <category>CLIENT</category> + <cardinality>1+</cardinality> + <versionAdvertised>true</versionAdvertised> + <commandScript> + <script>scripts/zookeeper_client.py</script> + <scriptType>PYTHON</scriptType> + </commandScript> + <configFiles> + <configFile> + <type>env</type> + <fileName>zookeeper-env.sh</fileName> + <dictionaryName>zookeeper-env</dictionaryName> + </configFile> + <configFile> + <type>env</type> + <fileName>log4j.properties</fileName> + <dictionaryName>zookeeper-log4j</dictionaryName> + </configFile> + </configFiles> + </component> + </components> + + <osSpecifics> + <osSpecific> + <osFamily>any</osFamily> + <packages> + <package> + <name>zookeeper</name> + </package> + </packages> + </osSpecific> + </osSpecifics> + + <commandScript> + <script>scripts/service_check.py</script> + <scriptType>PYTHON</scriptType> + <timeout>300</timeout> + </commandScript> + + <configuration-dependencies> + <config-type>zookeeper-log4j</config-type> + <config-type>zookeeper-env</config-type> + <config-type>zoo.cfg</config-type> + </configuration-dependencies> + <restartRequiredAfterChange>true</restartRequiredAfterChange> + </service> + </services> +</metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkEnv.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkEnv.sh b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkEnv.sh new file mode 100644 index 0000000..fa1b832 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkEnv.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env 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. + +# This script should be sourced into other zookeeper +# scripts to setup the env variables + +# We use ZOOCFGDIR if defined, +# otherwise we use /etc/zookeeper +# or the conf directory that is +# a sibling of this script's directory +if [ "x$ZOOCFGDIR" = "x" ] +then + if [ -d "/etc/zookeeper" ] + then + ZOOCFGDIR="/etc/zookeeper" + else + ZOOCFGDIR="$ZOOBINDIR/../conf" + fi +fi + +if [ "x$ZOOCFG" = "x" ] +then + ZOOCFG="zoo.cfg" +fi + +ZOOCFG="$ZOOCFGDIR/$ZOOCFG" + +if [ -e "$ZOOCFGDIR/zookeeper-env.sh" ] +then + . "$ZOOCFGDIR/zookeeper-env.sh" +fi + +if [ "x${ZOO_LOG_DIR}" = "x" ] +then + ZOO_LOG_DIR="." +fi + +if [ "x${ZOO_LOG4J_PROP}" = "x" ] +then + ZOO_LOG4J_PROP="INFO,CONSOLE" +fi + +#add the zoocfg dir to classpath +CLASSPATH="$ZOOCFGDIR:$CLASSPATH" + +for i in "$ZOOBINDIR"/../src/java/lib/*.jar +do + CLASSPATH="$i:$CLASSPATH" +done + +#make it work in the release +for i in "$ZOOBINDIR"/../lib/*.jar +do + CLASSPATH="$i:$CLASSPATH" +done + +#make it work in the release +for i in "$ZOOBINDIR"/../zookeeper-*.jar +do + CLASSPATH="$i:$CLASSPATH" +done + +#make it work for developers +for d in "$ZOOBINDIR"/../build/lib/*.jar +do + CLASSPATH="$d:$CLASSPATH" +done + +#make it work for developers +CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH" + +case "`uname`" in + CYGWIN*) cygwin=true ;; + *) cygwin=false ;; +esac + +if $cygwin +then + CLASSPATH=`cygpath -wp "$CLASSPATH"` +fi + +#echo "CLASSPATH=$CLASSPATH" http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkServer.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkServer.sh b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkServer.sh new file mode 100644 index 0000000..dd75a58 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkServer.sh @@ -0,0 +1,120 @@ +#!/usr/bin/env 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. + +# +# If this scripted is run out of /usr/bin or some other system bin directory +# it should be linked to and not copied. Things like java jar files are found +# relative to the canonical path of this script. +# + +# See the following page for extensive details on setting +# up the JVM to accept JMX remote management: +# http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html +# by default we allow local JMX connections +if [ "x$JMXLOCALONLY" = "x" ] +then + JMXLOCALONLY=false +fi + +if [ "x$JMXDISABLE" = "x" ] +then + echo "JMX enabled by default" + # for some reason these two options are necessary on jdk6 on Ubuntu + # accord to the docs they are not necessary, but otw jconsole cannot + # do a local attach + ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain" +else + echo "JMX disabled by user request" + ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain" +fi + +# Only follow symlinks if readlink supports it +if readlink -f "$0" > /dev/null 2>&1 +then + ZOOBIN=`readlink -f "$0"` +else + ZOOBIN="$0" +fi +ZOOBINDIR=`dirname "$ZOOBIN"` + +. "$ZOOBINDIR"/zkEnv.sh + +if [ "x$2" != "x" ] +then + ZOOCFG="$ZOOCFGDIR/$2" +fi + +if $cygwin +then + ZOOCFG=`cygpath -wp "$ZOOCFG"` + # cygwin has a "kill" in the shell itself, gets confused + KILL=/bin/kill +else + KILL=kill +fi + +echo "Using config: $ZOOCFG" + +ZOOPIDFILE=$(grep dataDir "$ZOOCFG" | sed -e 's/.*=//')/zookeeper_server.pid + + +case $1 in +start) + echo "Starting zookeeper ... " + $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \ + -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" & + /bin/echo -n $! > "$ZOOPIDFILE" + echo STARTED + ;; +stop) + echo "Stopping zookeeper ... " + if [ ! -f "$ZOOPIDFILE" ] + then + echo "error: could not find file $ZOOPIDFILE" + exit 1 + else + $KILL -9 $(cat "$ZOOPIDFILE") + rm "$ZOOPIDFILE" + echo STOPPED + fi + ;; +upgrade) + shift + echo "upgrading the servers to 3.*" + java "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \ + -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@} + echo "Upgrading ... " + ;; +restart) + shift + "$0" stop ${@} + sleep 3 + "$0" start ${@} + ;; +status) + STAT=`echo stat | nc localhost $(grep clientPort "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode` + if [ "x$STAT" = "x" ] + then + echo "Error contacting service. It is probably not running." + else + echo $STAT + fi + ;; +*) + echo "Usage: $0 {start|stop|restart|status}" >&2 + +esac http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkService.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkService.sh b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkService.sh new file mode 100644 index 0000000..59bfe90 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkService.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env 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. +# +# + +zkcli_script=$1 +user=$2 +conf_dir=$3 +/var/lib/ambari-agent/ambari-sudo.sh su $user -s /bin/bash - -c "source $conf_dir/zookeeper-env.sh ; echo 'ls /' | $zkcli_script" http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkSmoke.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkSmoke.sh b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkSmoke.sh new file mode 100644 index 0000000..4d1562e --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/files/zkSmoke.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env 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. +# +# + +zk_cli_shell=$1 +smoke_user=$2 +conf_dir=$3 +client_port=$4 +security_enabled=$5 +kinit_path_local=$6 +smoke_user_keytab=$7 +smokeuser_principal=$8 +test_output_file=$9 +export ZOOKEEPER_EXIT_CODE=0 +errors_expr="ERROR|Exception" +acceptable_expr="SecurityException" +zkhosts=` grep "^\s*server\.[[:digit:]]" $conf_dir/zoo.cfg | cut -f 2 -d '=' | cut -f 1 -d ':' | tr '\n' ' ' ` +zk_node1=`echo $zkhosts | tr ' ' '\n' | head -n 1` +echo "zk_node1=$zk_node1" +if [[ $security_enabled == "True" ]]; then + kinitcmd="$kinit_path_local -kt $smoke_user_keytab $smokeuser_principal" + /var/lib/ambari-agent/ambari-sudo.sh su $smoke_user -s /bin/bash - -c "$kinitcmd" +fi + +function verify_output() { + if [ -f $test_output_file ]; then + errors=`grep -E $errors_expr $test_output_file | grep -v $acceptable_expr` + if [ "$?" -eq 0 ]; then + echo "Error found in the zookeeper smoke test. Exiting." + echo $errors + exit 1 + fi + fi +} + +function rename_output(){ + if [ -f $test_output_file ]; then + time=$(date +"%s") + output_file=$(echo $test_output_file | cut -f 1 -d '.') + errors=`mv $test_output_file $output_file$time.out` + if [ "$?" -ne 0 ]; then + echo "Error found in the zookeeper smoke test. Exiting." + echo $errors + exit 1 + fi + fi +} + +# Delete /zk_smoketest znode if exists +/var/lib/ambari-agent/ambari-sudo.sh su $smoke_user -s /bin/bash - -c "source $conf_dir/zookeeper-env.sh ; echo delete /zk_smoketest | ${zk_cli_shell} -server $zk_node1:$client_port" 2>&1>$test_output_file +# Create /zk_smoketest znode on one zookeeper server +/var/lib/ambari-agent/ambari-sudo.sh su $smoke_user -s /bin/bash - -c "source $conf_dir/zookeeper-env.sh ; echo create /zk_smoketest smoke_data | ${zk_cli_shell} -server $zk_node1:$client_port" 2>&1>>$test_output_file +verify_output +rename_output + +for i in $zkhosts ; do + echo "Running test on host $i" + # Verify the data associated with znode across all the nodes in the zookeeper quorum + /var/lib/ambari-agent/ambari-sudo.sh su $smoke_user -s /bin/bash - -c "source $conf_dir/zookeeper-env.sh ; echo 'get /zk_smoketest' | ${zk_cli_shell} -server $i:$client_port" + /var/lib/ambari-agent/ambari-sudo.sh su $smoke_user -s /bin/bash - -c "source $conf_dir/zookeeper-env.sh ; echo 'ls /' | ${zk_cli_shell} -server $i:$client_port" + output=$(/var/lib/ambari-agent/ambari-sudo.sh su $smoke_user -s /bin/bash - -c "source $conf_dir/zookeeper-env.sh ; echo 'get /zk_smoketest' | ${zk_cli_shell} -server $i:$client_port") + echo $output | grep smoke_data + if [[ $? -ne 0 ]] ; then + echo "Data associated with znode /zk_smoketests is not consistent on host $i" + ((ZOOKEEPER_EXIT_CODE=$ZOOKEEPER_EXIT_CODE+1)) + fi +done + +/var/lib/ambari-agent/ambari-sudo.sh su $smoke_user -s /bin/bash - -c "source $conf_dir/zookeeper-env.sh ; echo 'delete /zk_smoketest' | ${zk_cli_shell} -server $zk_node1:$client_port" +if [[ "$ZOOKEEPER_EXIT_CODE" -ne "0" ]] ; then + echo "Zookeeper Smoke Test: Failed" +else + echo "Zookeeper Smoke Test: Passed" +fi +exit $ZOOKEEPER_EXIT_CODE http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/__init__.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/__init__.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/__init__.py new file mode 100644 index 0000000..35de4bb --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/__init__.py @@ -0,0 +1,20 @@ +""" +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. + +Ambari Agent + +""" http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params.py new file mode 100644 index 0000000..fbefec9 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params.py @@ -0,0 +1,27 @@ +""" +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. + +Ambari Agent + +""" +from ambari_commons import OSCheck + +if OSCheck.is_windows_family(): + from params_windows import * +else: + from params_linux import * + http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_linux.py new file mode 100644 index 0000000..84cc431 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_linux.py @@ -0,0 +1,105 @@ +""" +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. + +Ambari Agent + +""" +import status_params +import os + +from resource_management.libraries.functions import format +from resource_management.libraries.functions.version import format_stack_version +from resource_management.libraries.functions.default import default +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions import get_kinit_path +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.script.script import Script +from resource_management.libraries.functions.expect import expect + +# server configurations +config = Script.get_config() +tmp_dir = Script.get_tmp_dir() + +stack_version_formatted = status_params.stack_version_formatted +stack_root = status_params.stack_root + +stack_name = status_params.stack_name +current_version = default("/hostLevelParams/current_version", None) +component_directory = status_params.component_directory + +# New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade +version = default("/commandParams/version", None) + +# default parameters +zk_home = "/usr" +zk_bin = "/usr/lib/zookeeper/bin" +zk_cli_shell = "/usr/lib/zookeeper/bin/zkCli.sh" +config_dir = "/etc/zookeeper/conf" +zk_smoke_out = os.path.join(tmp_dir, "zkSmoke.out") + +# hadoop parameters for stacks that support rolling_upgrade +if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted): + zk_home = format("{stack_root}/current/{component_directory}") + zk_bin = format("{stack_root}/current/{component_directory}/bin") + zk_cli_shell = format("{stack_root}/current/{component_directory}/bin/zkCli.sh") + config_dir = status_params.config_dir + + +zk_user = config['configurations']['zookeeper-env']['zk_user'] +hostname = config['hostname'] +user_group = config['configurations']['cluster-env']['user_group'] +zk_env_sh_template = config['configurations']['zookeeper-env']['content'] + +zk_log_dir = config['configurations']['zookeeper-env']['zk_log_dir'] +zk_data_dir = config['configurations']['zoo.cfg']['dataDir'] +zk_pid_dir = status_params.zk_pid_dir +zk_pid_file = status_params.zk_pid_file +zk_server_heapsize_value = default('configurations/zookeeper-env/zk_server_heapsize', "1024m") +zk_server_heapsize = format("-Xmx{zk_server_heapsize_value}") + +client_port = default('/configurations/zoo.cfg/clientPort', None) + +if 'zoo.cfg' in config['configurations']: + zoo_cfg_properties_map = config['configurations']['zoo.cfg'] +else: + zoo_cfg_properties_map = {} +zoo_cfg_properties_map_length = len(zoo_cfg_properties_map) + +zk_principal_name = default("/configurations/zookeeper-env/zookeeper_principal_name", "[email protected]") +zk_principal = zk_principal_name.replace('_HOST',hostname.lower()) + +java64_home = config['hostLevelParams']['java_home'] +java_version = expect("/hostLevelParams/java_version", int) + +zookeeper_hosts = config['clusterHostInfo']['zookeeper_hosts'] +zookeeper_hosts.sort() + +zk_keytab_path = config['configurations']['zookeeper-env']['zookeeper_keytab_path'] +zk_server_jaas_file = format("{config_dir}/zookeeper_jaas.conf") +zk_client_jaas_file = format("{config_dir}/zookeeper_client_jaas.conf") +security_enabled = config['configurations']['cluster-env']['security_enabled'] + +smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab'] +smokeuser = config['configurations']['cluster-env']['smokeuser'] +smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name'] +kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None)) + +#log4j.properties +if ('zookeeper-log4j' in config['configurations']) and ('content' in config['configurations']['zookeeper-log4j']): + log4j_props = config['configurations']['zookeeper-log4j']['content'] +else: + log4j_props = None http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_windows.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_windows.py new file mode 100644 index 0000000..c36e152 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/params_windows.py @@ -0,0 +1,68 @@ +""" +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. + +Ambari Agent + +""" +from ambari_commons.str_utils import ensure_double_backslashes +from resource_management import * +import status_params + +# server configurations +config = Script.get_config() + +config_dir = None +stack_root = None +try: + # not used zookeeper_home_dir = os.environ["ZOOKEEPER_HOME"] + config_dir = os.environ["ZOOKEEPER_CONF_DIR"] + stack_root = os.environ["HADOOP_NODE_INSTALL_ROOT"] +except: + pass + +hadoop_user = config["configurations"]["cluster-env"]["hadoop.user.name"] +zk_user = hadoop_user + +# notused zk_log_dir = config['configurations']['zookeeper-env']['zk_log_dir'] +zk_data_dir = ensure_double_backslashes(config['configurations']['zoo.cfg']['dataDir']) +tickTime = config['configurations']['zoo.cfg']['tickTime'] +initLimit = config['configurations']['zoo.cfg']['initLimit'] +syncLimit = config['configurations']['zoo.cfg']['syncLimit'] +clientPort = config['configurations']['zoo.cfg']['clientPort'] + +if 'zoo.cfg' in config['configurations']: + zoo_cfg_properties_map = config['configurations']['zoo.cfg'].copy() + # Fix the data dir - ZK won't start unless the backslashes are doubled + zoo_cfg_properties_map['dataDir'] = zk_data_dir +else: + zoo_cfg_properties_map = {} +zoo_cfg_properties_map_length = len(zoo_cfg_properties_map) + +zookeeper_hosts = config['clusterHostInfo']['zookeeper_hosts'] +zookeeper_hosts.sort() +hostname = config['hostname'] + +_authentication = config['configurations']['core-site']['hadoop.security.authentication'] +security_enabled = ( not is_empty(_authentication) and _authentication == 'kerberos') +user_group = None +zookeeper_win_service_name = status_params.zookeeper_win_service_name + +#log4j.properties +if (('zookeeper-log4j' in config['configurations']) and ('content' in config['configurations']['zookeeper-log4j'])): + log4j_props = config['configurations']['zookeeper-log4j']['content'] +else: + log4j_props = None http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/service_check.py new file mode 100644 index 0000000..622a5eb --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/service_check.py @@ -0,0 +1,73 @@ +""" +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. + +Ambari Agent + +""" + +from resource_management import * +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl + +class ZookeeperServiceCheck(Script): + pass + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class ZookeeperServiceCheckLinux(ZookeeperServiceCheck): + def service_check(self, env): + import params + env.set_params(params) + + File(params.zk_smoke_out, + action="delete" + ) + + File(format("{tmp_dir}/zkSmoke.sh"), + mode=0755, + content=StaticFile('zkSmoke.sh') + ) + + if params.security_enabled: + smokeUserKeytab=params.smoke_user_keytab + smokeUserPrincipal=params.smokeuser_principal + else: + smokeUserKeytab= "no_keytab" + smokeUserPrincipal="no_principal" + + + cmd_quorum = format("{tmp_dir}/zkSmoke.sh {zk_cli_shell} {smokeuser} {config_dir} {client_port} " + "{security_enabled} {kinit_path_local} {smokeUserKeytab} {smokeUserPrincipal} {zk_smoke_out}") + + Execute(cmd_quorum, + tries=3, + try_sleep=5, + path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin', + logoutput=True + ) + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class ZookeeperServiceCheckWindows(ZookeeperServiceCheck): + def service_check(self, env): + import params + env.set_params(params) + + smoke_cmd = os.path.join(params.stack_root,"Run-SmokeTests.cmd") + service = "Zookeeper" + Execute(format("cmd /C {smoke_cmd} {service}"), user=params.zk_user, logoutput=True, tries=3, try_sleep=20) + +if __name__ == "__main__": + ZookeeperServiceCheck().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/status_params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/status_params.py new file mode 100644 index 0000000..0a480f2 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/status_params.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +""" +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. + +""" +from ambari_commons import OSCheck +from resource_management.libraries.functions import format +from resource_management.libraries.functions.default import default +from resource_management.libraries.functions.version import format_stack_version +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions import get_kinit_path +from resource_management.libraries.script.script import Script + +# a map of the Ambari role to the component name +# for use with <stack-root>/current/<component> +SERVER_ROLE_DIRECTORY_MAP = { + 'ZOOKEEPER_SERVER' : 'zookeeper-server', + 'ZOOKEEPER_CLIENT' : 'zookeeper-client' +} + +component_directory = Script.get_component_from_role(SERVER_ROLE_DIRECTORY_MAP, "ZOOKEEPER_CLIENT") + +config = Script.get_config() + +if OSCheck.is_windows_family(): + zookeeper_win_service_name = "zkServer" +else: + zk_pid_dir = config['configurations']['zookeeper-env']['zk_pid_dir'] + zk_pid_file = format("{zk_pid_dir}/zookeeper_server.pid") + + # Security related/required params + hostname = config['hostname'] + security_enabled = config['configurations']['cluster-env']['security_enabled'] + kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None)) + tmp_dir = Script.get_tmp_dir() + zk_user = config['configurations']['zookeeper-env']['zk_user'] + + stack_version_unformatted = str(config['hostLevelParams']['stack_version']) + stack_version_formatted = format_stack_version(stack_version_unformatted) + stack_root = Script.get_stack_root() + + config_dir = "/etc/zookeeper/conf" + if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted): + config_dir = format("{stack_root}/current/{component_directory}/conf") +stack_name = default("/hostLevelParams/stack_name", None) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper.py new file mode 100644 index 0000000..e0ba54b --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper.py @@ -0,0 +1,164 @@ +""" +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. + +Ambari Agent + +""" +import os +import sys + +from resource_management import * +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.version import compare_versions, format_stack_version +from resource_management.libraries.functions.stack_features import check_stack_feature +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl + +@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT) +def zookeeper(type = None, upgrade_type=None): + import params + + if type == 'server': + # This path may be missing after Ambari upgrade. We need to create it. We need to do this before any configs will + # be applied. + if upgrade_type is None and not os.path.exists(os.path.join(params.stack_root,"/current/zookeeper-server")) and params.current_version\ + and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)): + conf_select.select(params.stack_name, "zookeeper", params.current_version) + stack_select.select("zookeeper-server", params.version) + + Directory(params.config_dir, + owner=params.zk_user, + create_parents = True, + group=params.user_group + ) + + File(os.path.join(params.config_dir, "zookeeper-env.sh"), + content=InlineTemplate(params.zk_env_sh_template), + owner=params.zk_user, + group=params.user_group + ) + + + configFile("zoo.cfg", template_name="zoo.cfg.j2") + configFile("configuration.xsl", template_name="configuration.xsl.j2") + + Directory(params.zk_pid_dir, + owner=params.zk_user, + create_parents = True, + group=params.user_group, + mode=0755, + ) + + Directory(params.zk_log_dir, + owner=params.zk_user, + create_parents = True, + group=params.user_group, + mode=0755, + ) + + Directory(params.zk_data_dir, + owner=params.zk_user, + create_parents = True, + cd_access="a", + group=params.user_group, + mode=0755, + ) + + if type == 'server': + myid = str(sorted(params.zookeeper_hosts).index(params.hostname) + 1) + + File(os.path.join(params.zk_data_dir, "myid"), + mode = 0644, + content = myid + ) + + if (params.log4j_props != None): + File(os.path.join(params.config_dir, "log4j.properties"), + mode=0644, + group=params.user_group, + owner=params.zk_user, + content=params.log4j_props + ) + elif (os.path.exists(os.path.join(params.config_dir, "log4j.properties"))): + File(os.path.join(params.config_dir, "log4j.properties"), + mode=0644, + group=params.user_group, + owner=params.zk_user + ) + + if params.security_enabled: + if type == "server": + configFile("zookeeper_jaas.conf", template_name="zookeeper_jaas.conf.j2") + configFile("zookeeper_client_jaas.conf", template_name="zookeeper_client_jaas.conf.j2") + else: + configFile("zookeeper_client_jaas.conf", template_name="zookeeper_client_jaas.conf.j2") + + File(os.path.join(params.config_dir, "zoo_sample.cfg"), + owner=params.zk_user, + group=params.user_group + ) + +@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY) +def zookeeper(type = None, upgrade_type=None): + import params + configFile("zoo.cfg", template_name="zoo.cfg.j2", mode="f") + configFile("configuration.xsl", template_name="configuration.xsl.j2", mode="f") + + ServiceConfig(params.zookeeper_win_service_name, + action="change_user", + username = params.zk_user, + password = Script.get_password(params.zk_user)) + + + Directory(params.zk_data_dir, + owner=params.zk_user, + mode="(OI)(CI)F", + create_parents = True + ) + if (params.log4j_props != None): + File(os.path.join(params.config_dir, "log4j.properties"), + mode="f", + owner=params.zk_user, + content=params.log4j_props + ) + elif (os.path.exists(os.path.join(params.config_dir, "log4j.properties"))): + File(os.path.join(params.config_dir, "log4j.properties"), + mode="f", + owner=params.zk_user + ) + if type == 'server': + myid = str(sorted(params.zookeeper_hosts).index(params.hostname) + 1) + File(os.path.join(params.zk_data_dir, "myid"), + owner=params.zk_user, + mode = "f", + content = myid + ) + +def configFile(name, template_name=None, mode=None): + import params + + File(os.path.join(params.config_dir, name), + content=Template(template_name), + owner=params.zk_user, + group=params.user_group, + mode=mode + ) + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py new file mode 100644 index 0000000..de4d6e1 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py @@ -0,0 +1,83 @@ +""" +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. + +Ambari Agent + +""" + +import sys +from resource_management import * +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.version import compare_versions, format_stack_version +from resource_management.libraries.functions.format import format +from resource_management.libraries.functions.stack_features import check_stack_feature +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl + +from zookeeper import zookeeper + +class ZookeeperClient(Script): + def configure(self, env): + import params + env.set_params(params) + zookeeper(type='client') + pass + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + self.configure(env) + pass + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + pass + + def status(self, env): + raise ClientComponentHasNoStatus() + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class ZookeeperClientLinux(ZookeeperClient): + def get_component_name(self): + return "zookeeper-client" + + def install(self, env): + self.install_packages(env) + self.configure(env) + + def pre_upgrade_restart(self, env, upgrade_type=None): + Logger.info("Executing Stack Upgrade pre-restart") + import params + env.set_params(params) + + if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)): + conf_select.select(params.stack_name, "zookeeper", params.version) + stack_select.select("zookeeper-client", params.version) + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class ZookeeperClientWindows(ZookeeperClient): + def install(self, env): + # client checks env var to determine if it is installed + if not os.environ.has_key("ZOOKEEPER_HOME"): + self.install_packages(env) + self.configure(env) + +if __name__ == "__main__": + ZookeeperClient().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py new file mode 100644 index 0000000..8a8bb11 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py @@ -0,0 +1,189 @@ +""" +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. + +Ambari Agent + +""" +import random +import sys + +from resource_management.libraries.script.script import Script +from resource_management.libraries.functions import get_unique_id_and_date +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.version import compare_versions, format_stack_version +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions.security_commons import build_expectations, \ + cached_kinit_executor, get_params_from_filesystem, validate_security_config_properties, \ + FILE_TYPE_JAAS_CONF +from resource_management.core import shell +from resource_management.core.logger import Logger +from resource_management.core.resources.system import Execute +from resource_management.libraries.functions.check_process_status import check_process_status +from resource_management.libraries.functions.format import format +from resource_management.libraries.functions.validate import call_and_match_output +from zookeeper import zookeeper +from zookeeper_service import zookeeper_service +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyImpl + + +class ZookeeperServer(Script): + + def configure(self, env, upgrade_type=None): + import params + env.set_params(params) + zookeeper(type='server', upgrade_type=upgrade_type) + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + self.configure(env, upgrade_type=upgrade_type) + zookeeper_service(action='start', upgrade_type=upgrade_type) + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + zookeeper_service(action='stop', upgrade_type=upgrade_type) + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class ZookeeperServerLinux(ZookeeperServer): + + def get_component_name(self): + return "zookeeper-server" + + def install(self, env): + self.install_packages(env) + self.configure(env) + + def pre_upgrade_restart(self, env, upgrade_type=None): + Logger.info("Executing Stack Upgrade pre-restart") + import params + env.set_params(params) + + if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)): + conf_select.select(params.stack_name, "zookeeper", params.version) + stack_select.select("zookeeper-server", params.version) + + def post_upgrade_restart(self, env, upgrade_type=None): + if upgrade_type == "nonrolling": + return + + Logger.info("Executing Stack Upgrade post-restart") + import params + env.set_params(params) + zk_server_host = random.choice(params.zookeeper_hosts) + cli_shell = format("{zk_cli_shell} -server {zk_server_host}:{client_port}") + # Ensure that a quorum is still formed. + unique = get_unique_id_and_date() + create_command = format("echo 'create /{unique} mydata' | {cli_shell}") + list_command = format("echo 'ls /' | {cli_shell}") + delete_command = format("echo 'delete /{unique} ' | {cli_shell}") + + quorum_err_message = "Failed to establish zookeeper quorum" + call_and_match_output(create_command, 'Created', quorum_err_message, user=params.zk_user) + call_and_match_output(list_command, r"\[.*?" + unique + ".*?\]", quorum_err_message, user=params.zk_user) + shell.call(delete_command, user=params.zk_user) + + if params.client_port: + check_leader_command = format("echo stat | nc localhost {client_port} | grep Mode") + code, out = shell.call(check_leader_command, logoutput=False) + if code == 0 and out: + Logger.info(out) + + def status(self, env): + import status_params + env.set_params(status_params) + check_process_status(status_params.zk_pid_file) + + def security_status(self, env): + import status_params + env.set_params(status_params) + + if status_params.security_enabled: + # Expect the following files to be available in params.config_dir: + # zookeeper_jaas.conf + # zookeeper_client_jaas.conf + try: + props_value_check = None + props_empty_check = ['Server/keyTab', 'Server/principal'] + props_read_check = ['Server/keyTab'] + zk_env_expectations = build_expectations('zookeeper_jaas', props_value_check, props_empty_check, + props_read_check) + + zk_expectations = {} + zk_expectations.update(zk_env_expectations) + + security_params = get_params_from_filesystem(status_params.config_dir, + {'zookeeper_jaas.conf': FILE_TYPE_JAAS_CONF}) + + result_issues = validate_security_config_properties(security_params, zk_expectations) + if not result_issues: # If all validations passed successfully + # Double check the dict before calling execute + if ( 'zookeeper_jaas' not in security_params + or 'Server' not in security_params['zookeeper_jaas'] + or 'keyTab' not in security_params['zookeeper_jaas']['Server'] + or 'principal' not in security_params['zookeeper_jaas']['Server']): + self.put_structured_out({"securityState": "ERROR"}) + self.put_structured_out({"securityIssuesFound": "Keytab file or principal are not set property."}) + return + + cached_kinit_executor(status_params.kinit_path_local, + status_params.zk_user, + security_params['zookeeper_jaas']['Server']['keyTab'], + security_params['zookeeper_jaas']['Server']['principal'], + status_params.hostname, + status_params.tmp_dir) + self.put_structured_out({"securityState": "SECURED_KERBEROS"}) + else: + issues = [] + for cf in result_issues: + issues.append("Configuration file %s did not pass the validation. Reason: %s" % (cf, result_issues[cf])) + self.put_structured_out({"securityIssuesFound": ". ".join(issues)}) + self.put_structured_out({"securityState": "UNSECURED"}) + except Exception as e: + self.put_structured_out({"securityState": "ERROR"}) + self.put_structured_out({"securityStateErrorInfo": str(e)}) + else: + self.put_structured_out({"securityState": "UNSECURED"}) + + def get_log_folder(self): + import params + return params.zk_log_dir + + def get_user(self): + import params + return params.zk_user + + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class ZookeeperServerWindows(ZookeeperServer): + def install(self, env): + from resource_management.libraries.functions.windows_service_utils import check_windows_service_exists + import params + if not check_windows_service_exists(params.zookeeper_win_service_name): + self.install_packages(env) + self.configure(env) + + def status(self, env): + from resource_management.libraries.functions.windows_service_utils import check_windows_service_status + import status_params + check_windows_service_status(status_params.zookeeper_win_service_name) + +if __name__ == "__main__": + ZookeeperServer().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_service.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_service.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_service.py new file mode 100644 index 0000000..9f943d7 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_service.py @@ -0,0 +1,82 @@ +""" +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. + +Ambari Agent + +""" + +import os +from resource_management import * +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.version import compare_versions, format_stack_version +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions.show_logs import show_logs + +@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT) +def zookeeper_service(action='start', upgrade_type=None): + import params + + # This path may be missing after Ambari upgrade. We need to create it. + if upgrade_type is None and not os.path.exists(os.path.join(params.stack_root,"/current/zookeeper-server")) and params.current_version \ + and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)): + conf_select.select(params.stack_name, "zookeeper", params.current_version) + stack_select.select("zookeeper-server", params.version) + + cmd = format("env ZOOCFGDIR={config_dir} ZOOCFG=zoo.cfg {zk_bin}/zkServer.sh") + + if action == 'start': + daemon_cmd = format("source {config_dir}/zookeeper-env.sh ; {cmd} start") + no_op_test = format("ls {zk_pid_file} >/dev/null 2>&1 && ps -p `cat {zk_pid_file}` >/dev/null 2>&1") + + try: + Execute(daemon_cmd, + not_if=no_op_test, + user=params.zk_user + ) + except: + show_logs(params.zk_log_dir, params.zk_user) + raise + + if params.security_enabled: + kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal};") + + Execute(kinit_cmd, + user=params.smokeuser + ) + + elif action == 'stop': + daemon_cmd = format("source {config_dir}/zookeeper-env.sh ; {cmd} stop") + try: + Execute(daemon_cmd, + user=params.zk_user + ) + except: + show_logs(params.zk_log_dir, params.zk_user) + raise + File(params.zk_pid_file, action="delete") + +@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY) +def zookeeper_service(action='start', rolling_restart=False): + import params + if action == 'start': + Service(params.zookeeper_win_service_name, action="start") + elif action == 'stop': + Service(params.zookeeper_win_service_name, action="stop") \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/configuration.xsl.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/configuration.xsl.j2 b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/configuration.xsl.j2 new file mode 100644 index 0000000..8830c45 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/configuration.xsl.j2 @@ -0,0 +1,42 @@ +{# +# 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. +#} + +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +<xsl:output method="html"/> +<xsl:template match="configuration"> +<html> +<body> +<table border="1"> +<tr> + <td>name</td> + <td>value</td> + <td>description</td> +</tr> +<xsl:for-each select="property"> + <tr> + <td><a name="{name}"><xsl:value-of select="name"/></a></td> + <td><xsl:value-of select="value"/></td> + <td><xsl:value-of select="description"/></td> + </tr> +</xsl:for-each> +</table> +</body> +</html> +</xsl:template> +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zoo.cfg.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zoo.cfg.j2 b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zoo.cfg.j2 new file mode 100644 index 0000000..1fbc0cc --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zoo.cfg.j2 @@ -0,0 +1,53 @@ +{# +# 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. +#} + +# +# +# 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. +# +# +# + +{% for key, value in zoo_cfg_properties_map.iteritems() -%} + {{key}}={{value}} +{% endfor %} +{% for host in zookeeper_hosts -%} +server.{{loop.index}}={{host}}:2888:3888 +{% endfor %} + +{% if security_enabled -%} +authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider +jaasLoginRenew=3600000 +kerberos.removeHostFromPrincipal=true +kerberos.removeRealmFromPrincipal=true +{% endif %} http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_client_jaas.conf.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_client_jaas.conf.j2 b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_client_jaas.conf.j2 new file mode 100644 index 0000000..38f9721 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_client_jaas.conf.j2 @@ -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. +#} + +Client { +com.sun.security.auth.module.Krb5LoginModule required +useKeyTab=false +useTicketCache=true; +}; http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_jaas.conf.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_jaas.conf.j2 b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_jaas.conf.j2 new file mode 100644 index 0000000..c3e9505 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/templates/zookeeper_jaas.conf.j2 @@ -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. +#} + +Server { +com.sun.security.auth.module.Krb5LoginModule required +useKeyTab=true +storeKey=true +useTicketCache=false +keyTab="{{zk_keytab_path}}" +principal="{{zk_principal}}"; +}; http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml new file mode 100644 index 0000000..090e35d --- /dev/null +++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml @@ -0,0 +1,51 @@ +<?xml version="1.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. +--> +<metainfo> + <schemaVersion>2.0</schemaVersion> + <services> + <service> + <name>ZOOKEEPER</name> + <extends>common-services/ZOOKEEPER/3.4.5</extends> + <version>3.4.6</version> + <osSpecifics> + <osSpecific> + <osFamily>amazon2015,redhat6,suse11,suse12</osFamily> + <packages> + <package> + <name>zookeeper_${stack_version}</name> + </package> + <package> + <name>zookeeper_${stack_version}-server</name> + </package> + </packages> + </osSpecific> + <osSpecific> + <osFamily>ubuntu12</osFamily> + <packages> + <package> + <name>zookeeper-${stack_version}</name> + </package> + <package> + <name>zookeeper-${stack_version}-server</name> + </package> + </packages> + </osSpecific> + </osSpecifics> + </service> + </services> +</metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/metainfo.xml index 06956a5..7edec7d 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/ZOOKEEPER/metainfo.xml @@ -20,7 +20,8 @@ <services> <service> <name>ZOOKEEPER</name> - <extends>common-services/ZOOKEEPER/3.4.5.2.0</extends> + <version>3.4.5.2.0</version> + <extends>common-services/ZOOKEEPER/3.4.5</extends> </service> </services> </metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml index 13dcbdb..4f4520b 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml @@ -21,30 +21,7 @@ <service> <name>ZOOKEEPER</name> <version>3.4.6.2.3</version> - <osSpecifics> - <osSpecific> - <osFamily>amazon2015,redhat6,suse11,suse12</osFamily> - <packages> - <package> - <name>zookeeper_${stack_version}</name> - </package> - <package> - <name>zookeeper_${stack_version}-server</name> - </package> - </packages> - </osSpecific> - <osSpecific> - <osFamily>ubuntu12</osFamily> - <packages> - <package> - <name>zookeeper-${stack_version}</name> - </package> - <package> - <name>zookeeper-${stack_version}-server</name> - </package> - </packages> - </osSpecific> - </osSpecifics> + <extends>common-services/ZOOKEEPER/3.4.6</extends> </service> </services> </metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/metainfo.xml index afcc9cb..9be9248 100644 --- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/ZOOKEEPER/metainfo.xml @@ -20,8 +20,8 @@ <services> <service> <name>ZOOKEEPER</name> - <extends>common-services/ZOOKEEPER/3.4.5.2.0</extends> <version>3.4.5.2.1.1.0</version> + <extends>common-services/ZOOKEEPER/3.4.5</extends> <components> <component> http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/test/java/org/apache/ambari/server/stack/KerberosDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/KerberosDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/KerberosDescriptorTest.java index b8f9670..2721a8e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/stack/KerberosDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/KerberosDescriptorTest.java @@ -143,7 +143,7 @@ public class KerberosDescriptorTest { @Test public void testCommonZookeepeerServiceDescriptor() throws IOException { - KerberosDescriptor descriptor = getKerberosDescriptor(commonServicesDirectory, "ZOOKEEPER", "3.4.5.2.0"); + KerberosDescriptor descriptor = getKerberosDescriptor(commonServicesDirectory, "ZOOKEEPER", "3.4.5"); Assert.notNull(descriptor); Assert.notNull(descriptor.getServices()); Assert.notNull(descriptor.getService("ZOOKEEPER")); http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py index c9b7064..8e028a1 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py +++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py @@ -24,7 +24,7 @@ from stacks.utils.RMFTestCase import * @patch("os.path.exists", new = MagicMock(return_value=True)) @patch("platform.linux_distribution", new = MagicMock(return_value="Linux")) class TestZookeeperClient(RMFTestCase): - COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5.2.0/package" + COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5/package" STACK_VERSION = "2.0.6" def test_configure_default(self): http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py index 44bbe3d..7757fd9 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py +++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py @@ -25,7 +25,7 @@ import resource_management.libraries.functions.get_unique_id_and_date @patch("os.path.exists", new = MagicMock(return_value=True)) @patch("platform.linux_distribution", new = MagicMock(return_value="Linux")) class TestZookeeperServer(RMFTestCase): - COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5.2.0/package" + COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5/package" STACK_VERSION = "2.0.6" def test_configure_default(self): http://git-wip-us.apache.org/repos/asf/ambari/blob/96d3afe0/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_service_check.py b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_service_check.py index 863505b..11287b9 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_service_check.py +++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_service_check.py @@ -21,7 +21,7 @@ from mock.mock import MagicMock, call, patch from stacks.utils.RMFTestCase import * class TestServiceCheck(RMFTestCase): - COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5.2.0/package" + COMMON_SERVICES_PACKAGE_DIR = "ZOOKEEPER/3.4.5/package" STACK_VERSION = "2.0.6" def test_service_check_default(self):
