package init
This commit is contained in:
parent
b5587ea90b
commit
e9b6144149
BIN
galera-3-25.3.26.tar.gz
Normal file
BIN
galera-3-25.3.26.tar.gz
Normal file
Binary file not shown.
17
galera-python3.patch
Normal file
17
galera-python3.patch
Normal file
@ -0,0 +1,17 @@
|
||||
Upstream PR:
|
||||
https://github.com/codership/galera/pull/512
|
||||
|
||||
diff -up galera-25.3.23/SConstruct.bak galera-25.3.23/SConstruct
|
||||
--- galera-25.3.23/SConstruct.bak 2018-07-13 15:14:49.059835554 +0200
|
||||
+++ galera-25.3.23/SConstruct 2018-07-13 15:19:07.717967794 +0200
|
||||
@@ -194,8 +194,8 @@ if link != 'default':
|
||||
env.Replace(LINK = link)
|
||||
|
||||
# Get compiler name/version, CXX may be set to "c++" which may be clang or gcc
|
||||
-cc_version = str(read_first_line(env['CC'].split() + ['--version']))
|
||||
-cxx_version = str(read_first_line(env['CXX'].split() + ['--version']))
|
||||
+cc_version = str(read_first_line(env['CC'].split() + ['--version']).decode())
|
||||
+cxx_version = str(read_first_line(env['CXX'].split() + ['--version']).decode())
|
||||
|
||||
print('Using C compiler executable: ' + env['CC'])
|
||||
print('C compiler version is: ' + cc_version)
|
||||
73
galera.spec
Normal file
73
galera.spec
Normal file
@ -0,0 +1,73 @@
|
||||
%global galeradoc %{buildroot}%{_docdir}/galera
|
||||
Name: galera
|
||||
Version: 25.3.26
|
||||
Release: 2
|
||||
Summary: Synchronous multi-master replication library
|
||||
License: GPLv2
|
||||
URL: http://galeracluster.com/
|
||||
Source0: http://releases.galeracluster.com/%{name}-3.26/source/%{name}-3-%{version}.tar.gz
|
||||
Source1: garbd.service
|
||||
#systemd startup script
|
||||
Source2: garbd-wrapper
|
||||
|
||||
#Use decode to make the SConstruct Python3 compatible
|
||||
#https://github.com/codership/galera/commit/71685db8da72b81a0950c19269281d10ae179706.patch
|
||||
Patch0000: galera-python3.patch
|
||||
|
||||
BuildRequires: asio-devel boost-devel check-devel gcc-c++ openssl-devel python3-scons systemd
|
||||
Requires: nmap-ncat
|
||||
|
||||
Requires(post,preun,postun): systemd
|
||||
|
||||
%description
|
||||
This is Galera replication - Codership's implementation of the write set replication (wsrep) interface.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-3-%{version} -p1
|
||||
|
||||
%build
|
||||
%{set_build_flags}
|
||||
|
||||
CPPFLAGS=`echo $CPPFLAGS| sed -e "s|-Wp,-D_GLIBCXX_ASSERTIONS||g" `
|
||||
CFLAGS=`echo $CFLAGS| sed -e "s|-Wp,-D_GLIBCXX_ASSERTIONS||g" `
|
||||
CXXFLAGS=`echo $CXXFLAGS| sed -e "s|-Wp,-D_GLIBCXX_ASSERTIONS||g" `
|
||||
export CPPFLAGS CFLAGS CXXFLAGS
|
||||
|
||||
scons-3 %{?_smp_mflags} strict_build_flags=1
|
||||
|
||||
%install
|
||||
install -D -m 644 COPYING %{galeradoc}/COPYING
|
||||
install -D -m 644 asio/LICENSE_1_0.txt %{galeradoc}/LICENSE.asio
|
||||
install -D -m 644 chromium/LICENSE %{galeradoc}/LICENSE.chromium
|
||||
install -D -m 644 www.evanjones.ca/LICENSE %{galeradoc}/LICENSE.crc32
|
||||
install -D -m 644 scripts/packages/README %{galeradoc}/README
|
||||
install -D -m 644 scripts/packages/README-MySQL %{galeradoc}/README-MySQL
|
||||
install -D -m 644 garb/files/garb.cnf %{buildroot}%{_sysconfdir}/sysconfig/garb
|
||||
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/garbd.service
|
||||
install -D -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/garbd-wrapper
|
||||
install -D -m 755 garb/garbd %{buildroot}%{_sbindir}/garbd
|
||||
install -D -m 755 libgalera_smm.so %{buildroot}%{_libdir}/galera/libgalera_smm.so
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
%systemd_post garbd.service
|
||||
|
||||
%preun
|
||||
%systemd_preun garbd.service
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
%systemd_postun_with_restart garbd.service
|
||||
|
||||
%files
|
||||
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/garb
|
||||
%dir %{_docdir}/galera
|
||||
%doc %{_docdir}/galera/*
|
||||
%dir %{_libdir}/galera
|
||||
%{_libdir}/galera/libgalera_smm.so
|
||||
%{_sbindir}/garbd*
|
||||
%{_unitdir}/garbd.service
|
||||
|
||||
%changelog
|
||||
* Thu Mar 4 2020 zhouyihang<zhouyihang1@huawei.com> - 25.3.26-2
|
||||
- Pakcage init
|
||||
38
garbd-wrapper
Executable file
38
garbd-wrapper
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/sh
|
||||
# This script is simple wrapper around garbd, that parses startup configuration.
|
||||
# Its main purpose is to bridge the differences between initscript and systemd unit file.
|
||||
|
||||
CONFIG_FILE=/etc/sysconfig/garb
|
||||
|
||||
source $CONFIG_FILE
|
||||
|
||||
# Check that node addresses and group name are configured
|
||||
if [ -z "$GALERA_NODES" ]; then
|
||||
echo "List of GALERA_NODES is not configured" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$GALERA_GROUP" ]; then
|
||||
echo "GALERA_GROUP name is not configured" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GALERA_PORT=${GALERA_PORT:-4567}
|
||||
|
||||
# Find a working node
|
||||
for ADDRESS in ${GALERA_NODES} 0; do
|
||||
HOST=$(echo $ADDRESS | cut -d \: -f 1)
|
||||
PORT=$(echo $ADDRESS | cut -s -d \: -f 2)
|
||||
PORT=${PORT:-$GALERA_PORT}
|
||||
ncat --send-only --recv-only $HOST $PORT >/dev/null && break
|
||||
done
|
||||
if [ ${ADDRESS} == "0" ]; then
|
||||
echo "None of the nodes in GALERA_NODES is accessible" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OPTIONS="-a gcomm://$ADDRESS"
|
||||
[ -n "$GALERA_GROUP" ] && OPTIONS="$OPTIONS -g $GALERA_GROUP"
|
||||
[ -n "$GALERA_OPTIONS" ] && OPTIONS="$OPTIONS -o $GALERA_OPTIONS"
|
||||
[ -n "$LOG_FILE" ] && OPTIONS="$OPTIONS -l $LOG_FILE"
|
||||
|
||||
exec /usr/sbin/garbd $OPTIONS
|
||||
10
garbd.service
Normal file
10
garbd.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Galera Arbitrator(garbd) Daemon
|
||||
Documentation=https://galeracluster.com/library/documentation/arbitrator.html
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/garbd-wrapper
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
x
Reference in New Issue
Block a user