Atlas is a database middleware of Qihoo 360 open source, based on Mysql-proxy, has done a lot of transformation, is a suitable for the national conditions of high-performance MySQL middleware.
The official supply source download and rpm download, but found no srpm source package, so research, found a lot of problems, self-realization of the spec file, mainly solve the following problems:
1. Dependency Package Issues
2, the implementation of the standard init script, remove the ugly mysql-proxyd
3. Run Mysql-proxy with normal user privileges
4. Support CentOS 6 and CentOS 7 simultaneously
5. File path is distributed according to Linux directory tree standard FHS (/usr/local does not conform to RPM specification)
6, support development package (on GitHub, someone asked to find the header file)
In the spirit of the GPL, I want to contribute the results to the official to improve the installation experience. The contents of the Atlas.spec file are as follows:
%global _enable_debug_package 0%global debug_package %{nil}%global __os_install_post /usr/lib/rpm/brp-compress %{nil}Name: AtlasVersion: 2.2.1Release: 1%{?dist}Summary: A Proxy for The mysql client/server protocollicense: gplurl: https://github.com/qihoo360/ atlassource0: %{name}-%{version}.tar.gzsource1: mysql-proxy.cnfSource2: mysql-proxy.initbuildrequires: flex,libtoolbuildrequires: glib2-devel >= 2.32.0buildrequires: jemalloc-develbuildrequires: libevent-develbuildrequires: lua-devel >= 5.1buildrequires: mysql-develbuildrequires: openssl-develbuildrequires: pkgconfigrequires: opensslrequires: jemallocRequires: mysqlRequires: lua >= 5.1conflicts: mysql-proxyexcludearch: x86%descriptionAtlas is a MySQL protocol-based database middleware project developedand maintained by infrastructure team of the Web platform Departmentin QIHU 360 SOFTWARE CO. LIMITED (Nyse:qihu). it fixed lots of bugs andadded lot of new functions on the basis of mysql-proxy 0.8.2.currently the project has been widely applied in QIHU,many MySQL business has connected to the Atlas platform. The number of read and write requests forwarded by atlas has reached billions.%package develsummary: development files for AtlasRequires: Atlas = %{version}-%{release}%description develdevelopment files for atlas%prep%setup -q%build%configure --with-lua cflags= "$CFLAGS -dhave_lua_h " ldflags=" $LDFLAGS &NBSP;-LM&NBSP;-LDL -lcrypto -ljemalloc "make %{?_smp_mflags}%installrm -rf $RPM _build_root%{__make} destdir= $RPM _build_root install%{__mkdir} -p $RPM _build_root%{_localstatedir}/log/mysql-proxy%{__mkdir} - p $RPM _build_root%{_sysconfdir}/mysql-proxy%{__mkdir} -p $RPM _build_root%{_initrddir}%{__ install} -m 644 -p %{source1} $RPM _build_root%{_sysconfdir}/ mysql-proxy/mysql-proxy.cnf%{__install} -m755 %{source2} $RPM _build_root%{_ initrddir}/mysql-proxy%clean%{__rm} -rf $RPM _build_rootmake -s clean%pregetent group mysql >/dev/null | | groupadd -g 27 -o -r mysqlgetent passwd mysql >/dev/null | | useradd -u 27 -M -N -o -r -g mysql -s /bin/bash -d /var/lib/mysql mysqlexit 0% postldconfigchkconfig --add mysql-proxy | | :%postunldconfigchkconfig --del mysql-proxy | | :%files%defattr (-,root,root,-)%{_bindir}/mysql-proxy%{_bindir}/encrypt%{_bindir}/mysql-binlog-dump%{_ Bindir}/mysql-myisam-dump%exclude %{_bindir}/mysql-proxyd%config (Noreplace) %{_sysconfdir}/ Mysql-proxy/mysql-proxy.cnf%{_initrddir}/mysql-proxy%dir %attr (0755,mysql,mysql) %{_localstatedir}/ Log/mysql-proxy%dir %{_libdir}/mysql-proxy%{_libdir}/mysql-proxy/lua/*%{_libdir}/mysql-proxy/plugins/*%{_ Libdir}/libmysql-*%{_libdir}/libsql-*%doc examples/%files devel%defattr (-,root,root,-)%{_includedir} /*.h%{_libdir}/pkgconfig/mysql-chassis.pc%{_libdir}/pkgconfig/mysql-proxy.pc%changelog* thu nov 26 2015 purple grape <[email protected]>- fresh build
Note:
1, the official only provide el6 RPM package, but in CentOS 6 compile, there will be insufficient dependencies, the GLIB2 version must be greater than 2.32.0 (CentOS 6 is the official bring 2.28.8), so I will cenots 7 glib2 (2.40.0 version) was ported down to CentOS 6 to address dependency issues. See the link below for details.
Baidu Network Address: Http://pan.baidu.com/s/1pJpJzo3
This article is from the "Focus on Linux Operations" blog, please be sure to keep this source http://purplegrape.blog.51cto.com/1330104/1717054
"Compiling and packaging" atlas-2.2.1-1.el7.centos.src.rpm