├── .gitignore ├── zookeeper.sysconfig ├── log4j.properties ├── zoo.cfg ├── LICENSE.md ├── zookeeper.service ├── README.md └── zookeeper.spec /.gitignore: -------------------------------------------------------------------------------- 1 | *.rpm 2 | *.tar.gz 3 | -------------------------------------------------------------------------------- /zookeeper.sysconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Optional arguments passed to java process 3 | JAVA_OPTS="" 4 | -------------------------------------------------------------------------------- /log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # ZooKeeper Logging Configuration 3 | # 4 | log4j.rootLogger=INFO, CONSOLE 5 | # 6 | # Log INFO level and above messages to the console 7 | # 8 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 9 | log4j.appender.CONSOLE.Threshold=INFO 10 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 11 | log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n 12 | -------------------------------------------------------------------------------- /zoo.cfg: -------------------------------------------------------------------------------- 1 | # The number of milliseconds of each tick 2 | tickTime=2000 3 | # The number of ticks that the initial 4 | # synchronization phase can take 5 | initLimit=10 6 | # The number of ticks that can pass between 7 | # sending a request and getting an acknowledgement 8 | syncLimit=5 9 | # the directory where the snapshot is stored. 10 | dataDir=/var/lib/zookeeper/data 11 | # the port at which the clients will connect 12 | clientPort=2181 13 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2015 Sam Kottler 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 implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /zookeeper.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Apache Zookeeper server 3 | Documentation=http://zookeeper.apache.org 4 | Requires=network.target remote-fs.target 5 | After=network.target remote-fs.target 6 | 7 | [Service] 8 | SyslogIdentifier=zookeeper 9 | EnvironmentFile=-/etc/sysconfig/zookeeper 10 | User=zookeeper 11 | Group=zookeeper 12 | WorkingDirectory=/var/lib/zookeeper 13 | 14 | ExecStart=/usr/bin/java \ 15 | -Dzookeeper.log.dir=/var/log/zookeeper \ 16 | -Dlog4j.configuration=file:/etc/zookeeper/log4j.properties \ 17 | -cp /usr/lib/zookeeper/lib/* \ 18 | org.apache.zookeeper.server.quorum.QuorumPeerMain \ 19 | /etc/zookeeper/zoo.cfg 20 | 21 | StandardOutput=journal 22 | StandardError=journal 23 | SuccessExitStatus=130 24 | KillSignal=SIGINT 25 | ProtectSystem=full 26 | 27 | [Install] 28 | WantedBy=multi-user.target 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | This repository contains everything needed to build RPM's for zookeeper-server. 4 | The spec has been tested on EL7 with the EPEL repo enabled and Fedora 30. 5 | 6 | ## Prepare 7 | 8 | Ensure packages are installed that provide tools to build the srpm and mock build the binary rpms. 9 | 10 | - `sudo yum install -y rpm-build rpmdevtools mock` 11 | 12 | ## Building 13 | 14 | 1. `git clone https://github.com/skottler/zookeeper-rpms` 15 | 2. `cd zookeeper-rpms` 16 | 3. `rpmdev-setuptree` 17 | 4. `spectool -g zookeeper.spec` 18 | 5. `rpmbuild -bs --nodeps --define "_sourcedir $(pwd)" --define "_srcrpmdir $(pwd)" zookeeper.spec` 19 | 6. `sudo mock ` 20 | 21 | ## Start/Stop Zookeeper service 22 | 23 | ``` 24 | # systemctl start zookeeper 25 | # systemctl status zookeeper 26 | ● zookeeper.service - Apache Zookeeper server 27 | Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; disabled; vendor preset: disabled) 28 | Active: active (running) since Mon 2019-05-27 13:04:43 UTC; 3min 16s ago 29 | Docs: http://zookeeper.apache.org 30 | Main PID: 16416 (java) 31 | CGroup: /system.slice/zookeeper.service 32 | └─16416 /usr/bin/java -Dzookeeper.log.dir=/var/log/zookeeper -Dlog4j.configuration=fi... 33 | ... 34 | # systemctl stop zookeeper 35 | ``` 36 | 37 | ### Accessing zookeeper log files 38 | 39 | Zookeepers logs are available in systemd's `journal` facility with `zookeeper` identifier and can be accessed as: 40 | 41 | ``` 42 | $ journalctl -t zookeeper 43 | ``` 44 | 45 | ### Troubleshooting systemd installation 46 | 47 | Due to systemd/selinux [issue](https://bugzilla.redhat.com/show_bug.cgi?id=1224211) it may be required to restart `systemd` daemon: 48 | 49 | ``` 50 | # systemctl status zookeeper 51 | Failed to get properties: Access denied 52 | # systemctl daemon-reexec 53 | systemctl status zookeeper 54 | ● zookeeper.service - Apache Zookeeper server 55 | Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; disabled; vendor preset: disabled) 56 | Active: inactive (dead) 57 | Docs: http://zookeeper.apache.org 58 | ``` 59 | 60 | ## License 61 | 62 | All files in this repository are licensed under the Apache 2 license. Any 63 | redistribution of these files must include the original license as well as 64 | attribution to this repository. 65 | -------------------------------------------------------------------------------- /zookeeper.spec: -------------------------------------------------------------------------------- 1 | %define _noarch_libdir /usr/lib 2 | %define rel_ver 3.5.5 3 | %define pkg_ver 3 4 | 5 | Summary: High-performance coordination service for distributed applications. 6 | Name: zookeeper 7 | Version: %{rel_ver} 8 | Release: %{pkg_ver}%{?dist} 9 | License: Apache License v2.0 10 | Group: Applications/Databases 11 | URL: https://www.apache.org/dist/zookeeper/ 12 | BuildArch: noarch 13 | Source0: https://www.apache.org/dist/zookeeper/zookeeper-%{rel_ver}/apache-zookeeper-%{rel_ver}.tar.gz 14 | Source1: zookeeper.service 15 | Source2: zoo.cfg 16 | Source3: log4j.properties 17 | Source4: zookeeper.sysconfig 18 | BuildRoot: %{_tmppath}/%{name}-%{rel_ver}-%{release}-root 19 | BuildRequires: python-devel,gcc,make,libtool,autoconf,cppunit-devel,maven,hostname,systemd 20 | Requires: java,nc,systemd 21 | AutoReqProv: no 22 | 23 | %description 24 | ZooKeeper is a distributed, open-source coordination service for distributed 25 | applications. It exposes a simple set of primitives that distributed 26 | applications can build upon to implement higher level services for 27 | synchronization, configuration maintenance, and groups and naming. It is 28 | designed to be easy to program to, and uses a data model styled after the 29 | familiar directory tree structure of file systems. It runs in Java and has 30 | bindings for both Java and C. 31 | 32 | Coordination services are notoriously hard to get right. They are especially 33 | prone to errors such as race conditions and deadlock. The motivation behind 34 | ZooKeeper is to relieve distributed applications the responsibility of 35 | implementing coordination services from scratch. 36 | 37 | %define _zookeeper_noarch_libdir %{_noarch_libdir}/zookeeper 38 | %define _maindir %{buildroot}%{_zookeeper_noarch_libdir} 39 | 40 | %prep 41 | %setup -q -n apache-zookeeper-%{rel_ver} 42 | 43 | %build 44 | mvn -DskipTests package 45 | 46 | %install 47 | rm -rf %{buildroot} 48 | install -p -d %{buildroot}%{_zookeeper_noarch_libdir} 49 | cp -a bin %{buildroot}%{_zookeeper_noarch_libdir} 50 | 51 | mkdir -p %{buildroot}%{_sysconfdir}/zookeeper 52 | cp -a zookeeper-server/target/lib %{buildroot}%{_zookeeper_noarch_libdir} 53 | install -p -D -m 644 zookeeper-server/target/zookeeper-%{rel_ver}.jar %{buildroot}%{_zookeeper_noarch_libdir}/lib/zookeeper-%{rel_ver}.jar 54 | install -p -D -m 644 %{S:1} %{buildroot}%{_unitdir}/%{name}.service 55 | install -p -D -m 644 %{S:2} %{buildroot}%{_sysconfdir}/zookeeper/zoo.cfg 56 | install -p -D -m 644 %{S:3} %{buildroot}%{_sysconfdir}/zookeeper/log4j.properties 57 | install -p -D -m 644 %{S:4} %{buildroot}%{_sysconfdir}/sysconfig/zookeeper 58 | install -p -D -m 644 conf/configuration.xsl %{buildroot}%{_sysconfdir}/zookeeper/configuration.xsl 59 | install -d %{buildroot}%{_sbindir} 60 | install -d %{buildroot}%{_bindir} 61 | install -d %{buildroot}%{_localstatedir}/log/zookeeper 62 | install -d %{buildroot}%{_localstatedir}/lib/zookeeper 63 | install -d %{buildroot}%{_localstatedir}/lib/zookeeper/data 64 | install -p -d -D -m 0755 %{buildroot}%{_datadir}/zookeeper 65 | 66 | %clean 67 | rm -rf %{buildroot} 68 | 69 | %files 70 | %defattr(-,root,root,-) 71 | %doc LICENSE.txt NOTICE.txt README.md 72 | %doc zookeeper-docs zookeeper-recipes 73 | %dir %attr(0750, zookeeper, zookeeper) %{_localstatedir}/lib/zookeeper 74 | %dir %attr(0750, zookeeper, zookeeper) %{_localstatedir}/lib/zookeeper/data 75 | %dir %attr(0750, zookeeper, zookeeper) %{_localstatedir}/log/zookeeper 76 | %{_zookeeper_noarch_libdir} 77 | %{_unitdir}/%{name}.service 78 | %config(noreplace) %{_sysconfdir}/zookeeper 79 | %config(noreplace) %{_sysconfdir}/sysconfig/zookeeper 80 | 81 | %pre 82 | getent group zookeeper >/dev/null || groupadd -r zookeeper 83 | getent passwd zookeeper >/dev/null || useradd -r -g zookeeper -d / -s /sbin/nologin zookeeper 84 | exit 0 85 | 86 | %post 87 | %systemd_post %{name}.service 88 | 89 | %preun 90 | %systemd_preun %{name}.service 91 | 92 | %postun 93 | %systemd_postun_with_restart %{name}.service 94 | 95 | %changelog 96 | * Fri Oct 04 2019 Tigran Mkrtchyan - 3.5.5-3 97 | - fix loading of systemd environment file 98 | - introduce variable to control package version 99 | * Thu Jul 11 2019 Anton Samets 100 | - add needed Requeries for correct rpm building and fix URL and Source paths 101 | * Fri Jul 5 2019 Sam Kottler 102 | - Remove systemd-rpm-macros from BuildRequires 103 | * Tue Jun 25 2019 Tigran Mkrtchyan 104 | - remove obsolete files 105 | * Tue Jun 25 2019 Tigran Mkrtchyan - 3.5.5-1 106 | - migrate to zookeeper 3.5.5 107 | * Mon May 27 2019 Tigran Mkrtchyan - 3.4.14-2 108 | - Migrate to systemd 109 | * Thu May 02 2019 Tigran Mkrtchyan - 3.4.14-1 110 | - Bump version to 3.4.14 111 | * Mon Apr 17 2017 itxx00 - 3.4.10-1 112 | - Bump version to 3.4.10 113 | * Mon Mar 13 2017 itxx00 - 3.4.9-1 114 | - Bump version to 3.4.9 115 | * Thu Jul 7 2016 Jeremy Christian - 3.4.8-1 116 | - Bump version to 3.4.8 117 | * Mon Dec 8 2014 David Xie - 3.4.6-1 118 | - Bump version to 3.4.6 119 | * Thu May 30 2013 Sam Kottler - 3.4.5-1 120 | - Updated to 3.4.5 121 | * Tue Oct 2 2012 Sam Kottler - 3.3.2-1 122 | - Initialize package creation 123 | --------------------------------------------------------------------------------