MariaDB-Galera10源码安装

本文详细介绍了如何使用源码在CentOS6.5环境下安装MariaDB-Galera集群,包括编译环境准备、下载相关软件源码包、创建MySQL服务用户、解压并编译安装MariaDB-Galera、配置MariaDB、设置安全性、启动服务及进行基本测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MariaDB-Galera10源码安装

官方网站MariaDB <wbr><wbr><wbr>yum安装

https://mariadb.com/

http://galeracluster.com/

http://mirrors.neusoft.edu.cn/mariadb/mariadb-galera-10.0.14/source

http://mirrors.neusoft.edu.cn/mariadb/mariadb-galera-10.0.14/galera-25.3.5/

环境:CentOS6.5 x64

一.准备编译环境
1.卸载linux预装的mysql-libs
rpm -e --nodeps mysql-libs

2.安装编译必备工具及库

yum -y install gcc gcc-c++  cmake ncurses-devel bison libxml2-devel openssl-devel libevent-devel #必选

libaio-devel pam-devel  boost-devel valgrind-devel   #可选

libnl-devel popt-devel popt-static   #其它

#libevent-devel提供"event.h"


二、安装MariaDB-Galera

1.下载相关软件源码包

wget --no-check-certificate http://mirrors.neusoft.edu.cn/mariadb/mariadb-galera-10.0.14/source/mariadb-galera-10.0.14.tar.gz
wget --no-check-certificate  http://mirrors.neusoft.edu.cn/mariadb/mariadb-galera-10.0.14/galera-25.3.5/galera-25.3.5-1.rhel6.x86_64.rpm

2.建mysql服务的用户和用户组

[root@node2 rhel6]# groupadd mysql
[root@node2 rhel6]# useradd -s /sbin/nologin -g mysql -M mysql
[root@node2 rhel6]# id mysql
uid=500(mysql) gid=500(mysql) groups=500(mysql)

3.解压mariadb-galera到临时安装目录,通常放在/usr/local/src目录下

[root@node2 ~]# ls
mariadb-galera-10.0.14.tar.gz
[root@node2 ~]# tar -xvf mariadb-galera-10.0.14.tar.gz -C /usr/local/src/


4.通过cmake编译安装

[root@node2 ~]# cd /usr/local/src/mariadb-10.0.14/
[root@node2 mariadb-10.0.14]# mkdir rhel6
[root@node2 mariadb-10.0.14]# cd rhel6/
[root@node2 rhel6]# cmake

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_DATADIR=/var/lib/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=1 \
-DWITH_BIG_TABLES=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_SSL=system ..


[root@node2 rhel6]# make && make install

5.安装galera

[root@node2 ~]# rpm -ivh galera-25.3.5-1.rhel6.x86_64.rpm
Preparing...                ######################################## [100%]
   1:galera                 ######################################### [100%]
[root@node2 ~]# rpm -ql galera
/etc/init.d/garb
/etc/sysconfig/garb
/usr/bin/garbd
/usr/lib64/galera/libgalera_smm.so
/usr/share/doc/galera/COPYING
/usr/share/doc/galera/LICENSE.asio
/usr/share/doc/galera/LICENSE.chromium
/usr/share/doc/galera/LICENSE.crc32c
/usr/share/doc/galera/README
/usr/share/doc/galera/README-MySQL

三.配置MariaDB

1.将mysql管理调式工具添加到PATH路径

[root@node2 ~]# echo 'PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile

[root@node2 ~]# source /etc/profile

顺道也加一个man记录
[root@node2 ~]# ls /usr/local/mysql/man/
man1  man8
[root@node2 ~]# echo MANPATH /usr/local/mysql/man >>/etc/man.config

2.初始化mariadb
[root@node2 ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql
WARNING: The host 'node1' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MariaDB version. The MariaDB daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MariaDB privileges !
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
141125 11:39:24 [Note] WSREP: Read nil XID from storage engines, skipping position init
141125 11:39:24 [Note] WSREP: wsrep_load(): loading provider library 'none'
141125 11:39:24 [Note] InnoDB: Using mutexes to ref count buffer pool pages
... ...
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from
SkySQL Ab. You can contact us about this at sales@skysql.com.
Alternatively consider joining our community based development effort:
http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

3.配置/etc/my.cnf和/etc/init.d/mysql

[root@node2 ~]# cp /usr/local/src/mariadb-10.0.14/rhel6/support-files/my-huge.cnf /etc/my.cnf

[root@node2 ~]# cp /usr/local/src/mariadb-10.0.14/rhel6/support-files/mysql.server /etc/init.d/mysql
[root@node2 ~]# chmod +x /etc/init.d/mysql
[root@node2 ~]# ll /etc/init.d/mysql
-rwxr-xr-x. 1 root root 12055 Nov 24 14:25 /etc/init.d/mysql


4.启服务

[root@node2 ~]# /etc/init.d/mysql start
Starting MySQL. SUCCESS!
[root@node2 ~]# /etc/init.d/mysql status
 
SUCCESS! MySQL running (13372)
[root@node2 ~]# netstat -tunlp|grep mysqld
tcp        0      0 0.0.0.0: 3306                0.0.0.0:*                   LISTEN      13372/mysqld       
[root@node2 ~]# chkconfig mysql on
[root@node2 ~]# chkconfig --list mysql
mysql              0:off    1:off    2:on    3:on    4:on    5:on    6:off


5.安全设置

[root@rhel7-test1 ~]# mysql_secure_installation
/usr/local/mysql/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
 

     SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...
初次使用密码为空,这里直接回车即可
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y 
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!
这里设置mariadb的root密码

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!
删除匿名用户
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!
不允许mariadb root用户远程登录
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
删除test数据库
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!
权限下发
Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

也可以手动完成,


四.测试
[root@node2 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.0.14-MariaDB-wsrep-log Source distribution, wsrep_25.10.r4144

Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

+--------------------+


MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]> show engines\G;
*************************** 1. row ***************************
      Engine: CSV
     Support: YES

转载于:https://www.cnblogs.com/lixuebin/p/10814472.html

<think>好的,我现在需要帮助用户下载MariaDB的官方安装文件。首先,用户的问题是关于如何从MariaDB官方网站下载安装文件的,所以我需要先确认官方网站的地址是否正确,并且确保用户能够顺利访问。 根据用户提供的引用内容,特别是引用[1]和引用[3],里面提到了使用yum安装MariaDB-server和相关组件,以及在源码编译安装时的版本要求。但用户现在想要的是直接从官网下载安装文件,而不是通过包管理器或者一键脚本。因此,我需要提供官方网站的步骤。 首先,我应该回忆MariaDB的官方网站地址是否是mariadb.org,这个应该是正确的,因为MariaDB是MySQL的一个分支,由原开发者维护,官方网站确实是这个。然后,用户需要下载安装文件,可能需要不同的版本,比如稳定版或者最新版,也可能需要不同操作系统的版本,比如Linux的RPM或DEB包,或者Windows的安装程序。 接下来,我应该分步骤说明如何访问官网并找到下载页面。通常,官方网站的导航栏会有“Downloads”或类似的选项,点击进入后可能会让用户选择版本和操作系统。用户需要根据自己的系统选择合适的版本,比如选择Linux下的二进制包,或者源码包。另外,可能还需要注意是社区版还是企业版,一般用户应该使用社区版,也就是Community Server。 在用户提供的引用中,引用[4]提到了一键安装脚本,但用户现在明确需要官方下载,所以可能需要忽略这个引用。而引用[3]提到源码编译安装的要求,但用户可能更倾向于预编译的二进制文件,所以需要指导他们下载对应的二进制包。 另外,用户可能需要验证下载文件的完整性,比如通过MD5或SHA校验,或者GPG签名,这部分也应该提醒用户注意,以确保下载的文件没有被篡改。 可能的问题包括:下载页面是否有多个镜像站点,用户如何选择;是否需要注册账户才能下载(通常社区版不需要);下载后的安装步骤是否需要额外依赖,比如引用[1]中提到的安装MariaDB-server时还需要其他组件如galera、socat等,但用户只是下载安装文件,可能需要后续的安装指导。 另外,用户可能使用的是不同的操作系统,比如CentOS、Ubuntu或者Windows,需要指导他们选择对应的安装包格式,如RPM、DEB、ZIP等。如果用户是Linux用户,可能还需要说明如何使用下载的包进行安装,比如使用dpkg或rpm命令,或者添加到仓库中通过包管理器安装。 最后,需要确保提供的步骤清晰,避免使用过于技术化的术语,让用户能够一步步跟随操作。同时,生成的相关问题需要围绕MariaDB的下载、安装、配置以及可能遇到的问题,帮助用户进一步解决可能的需求。</think>### 下载MariaDB官方安装文件的步骤 1. **访问MariaDB官方网站** 打开浏览器,进入MariaDB官网:**[https://mariadb.org/download/](https://mariadb.org/download/)**[^2]。 2. **选择版本和操作系统** - 在页面中,找到**"Community Server"**(社区版,免费使用)。 - 选择所需的版本(推荐稳定版,如`Stable`)。 - 选择操作系统类型(如Linux、Windows)和具体发行版(如CentOS、Ubuntu)[^3]。 3. **下载安装包** - 对于Linux用户: - 可直接下载预编译的二进制包(如`.rpm`或`.deb`)。 - 或通过**Repository Configuration Tool**生成仓库配置,使用包管理器(如`yum`或`apt`)安装[^1]。 - 对于Windows用户: - 下载`.msi`安装程序,双击运行即可。 4. **验证文件完整性(可选)** - 官网提供**GPG签名**和**SHA校验码**,可通过工具(如`sha256sum`)验证文件是否被篡改。 --- ### 示例:通过Linux命令行下载 ```bash # 使用wget直接下载(替换为实际链接) wget https://downloads.mariadb.org/interstitial/mariadb-10.11.5/bintar-linux-systemd-x86_64/mariadb-10.11.5-linux-systemd-x86_64.tar.gz ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值