Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve manual build instructions for centos7 (maybe add pre-built docker images) #17

Open
anton-povarov opened this issue Mar 12, 2019 · 5 comments

Comments

@anton-povarov
Copy link
Contributor

Here's the HOWTO from Alexey Medov building on centos7 + mariadb 10.2
A nice starting point.

Добавляем репозиторий нужной версии MariaDB по инструкции по ссылке
https://downloads.mariadb.org/mariadb/repositories/#mirror=mephi&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.2

На тот случай если ссылка не работает, нужно создать файл /etc/yum.repos.d/MariaDB.repo и прописать в него следующий текст:

MariaDB 10.2 CentOS repository list - created 2019-03-06 07:50 UTC

http://downloads.mariadb.org/mariadb/repositories/

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Потом выполняем:
sudo rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
yum clean metadata
yum install MariaDB-backup MariaDB-client MariaDB-common MariaDB-compat MariaDB-server MariaDB-shared
mysql --version

==========================================================================

yum install autoconf automake cmake make git libtool ncurses-devel openssl-devel
yum install centos-release-scl
yum install devtoolset-6-gcc*
scl enable devtoolset-6 bash
which gcc
gcc --version
yum install git -y
mkdir /_install
mkdir /build_folder
cd /build_folder/

git clone https://github.com/anton-povarov/meow.git
git clone https://github.com/badoo/pinba2.git
git clone https://github.com/nanomsg/nanomsg.git
wget https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0_rc1.tar.gz
tar -xzf boost_1_69_0_rc1.tar.gz
rm -rf boost_1_69_0_rc1.tar.gz

Качаем нужную версию исходников MariaDB с официального сайта https://downloads.mariadb.org/mariadb/10.2.22/
wget http://mirror.mephi.ru/mariadb//mariadb-10.2.22/source/mariadb-10.2.22.tar.gz
tar -xzf mariadb-10.2.22.tar.gz
rm -rf mariadb-10.2.22.tar.gz
cd mariadb-10.2.22
yum-builddep mariadb-server
yum install bison libxml2-devel libevent-devel rpm-build
scl enable devtoolset-6 bash ; rm -rf CMakeCache.txt ; make clean ; cmake -DRPM=centos7 . ; make -j 6

cd ../nanomsg
cmake -DNN_STATIC_LIB=ON -DNN_ENABLE_DOC=OFF -NN_MAX_SOCKETS=4096 -DCMAKE_C_FLAGS="-fPIC -DPIC" -DCMAKE_INSTALL_PREFIX=/_install/nanomsg -DCMAKE_INSTALL_LIBDIR=lib .
make ; make install

cd ../pinba2
./buildconf.sh
./configure --prefix=/_install/pinba2 --with-mysql=/build_folder/mariadb-10.2.22/ --with-nanomsg=/_install/nanomsg --with-meow=/build_folder/meow/ --with-boost=/build_folder/boost_1_69_0 --enable-libmysqlservices
systemctl start mariadb && systemctl enable mariadb && systemctl status mariadb
yum install mariadb-devel
mysql_secure_installation

Далее добавляем в файл /etc/my.cnf.d/server.conf в секцию [mysqld] строку:
plugin_maturity=unknown
service mysqld restart && service mariadb restart
cp mysql_engine/.libs/libpinba_engine2.so mysql_config --plugindir
semanage permissive -a mysqld_t
echo "install plugin PINBA soname 'libpinba_engine2.so';" | mysql -uroot -p
echo "create database pinba;" | mysql -uroot -p
cat scripts/default_reports.sql | mysql -uroot -p
cat scripts/default_tables/active.sql | mysql -uroot -p
cat scripts/default_tables/info.sql | mysql -uroot -p
cat scripts/default_tables/stats.sql | mysql -uroot -p

@GhOsTMZ
Copy link

GhOsTMZ commented Nov 21, 2019

Some improvements for decreasing a compilation time. MySQL can be built without a server binary. For example:

cmake -DWITH_BOOST=boost_1_59_0 -DWITHOUT_SERVER=1 && make

This checked on percona server.

And I don't understand why you installed nanomsg. You using static linking and nanomsg installing it is not necessary.

I can upload my ugly rpmspec-file if you want. This can be a good starting point for a building pinba engine.

@anton-povarov
Copy link
Contributor Author

Nice tip, thanks.
rpmspec is also welcome of course.

@GhOsTMZ
Copy link

GhOsTMZ commented Nov 25, 2019

https://github.com/badoo/pinba2/files/3886244/pinba-engine.txt

rpmspec checked on centos 7 and percona server 5.7. devtoolset-7 required but not listed in BuildRequires. mysql-devel needed only for mysql_config utility for determine mysql plugin directory.

@anton-povarov
Copy link
Contributor Author

Thanks for the spec! At a brief glance, i think macro.patch file is referenced but missing from the upload?

@GhOsTMZ
Copy link

GhOsTMZ commented Dec 3, 2019

I can give a macro.patch. But it's a ugly hack for building from sources got by not a git clone command. If you getting sources by git clone you can exclude this patch.

diff -ru pinba2-2.5.0/mysql_engine/plugin.cpp pinba2-2.5.0.new/mysql_engine/plugin.cpp
--- pinba2-2.5.0/mysql_engine/plugin.cpp        2019-04-24 17:34:00.000000000 +0300
+++ pinba2-2.5.0.new/mysql_engine/plugin.cpp    2019-11-21 12:21:52.439922930 +0300
@@ -154,8 +154,8 @@
 
        // version and build info
        snprintf(vars->version_info, sizeof(vars->version_info),
-               "%s %s, git: %s, branch: %s, modified: %s",
-               PINBA_PACKAGE_NAME, PINBA_VERSION, PINBA_VCS_FULL_HASH, PINBA_VCS_BRANCH, PINBA_VCS_WC_MODIFIED);
+               "%s %s",
+               PINBA_PACKAGE_NAME, PINBA_VERSION);
 
        snprintf(vars->build_string, sizeof(vars->build_string), "%s", PINBA_BUILD_STRING);
 
@@ -262,7 +262,7 @@
                return std::make_shared<mysql_logger_t>(stderr, log_level);
        }();
 
-       LOG_NOTICE(logger, "version {0}, git: {1}, build: {2}", PINBA_VERSION, PINBA_VCS_FULL_HASH, PINBA_BUILD_STRING);
+       LOG_NOTICE(logger, "version {0}, build: {1}", PINBA_VERSION, PINBA_BUILD_STRING);
 
        try
        {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants