网站搭建计划放到day30,目前知识积累量还不足
分布式数据库系统是指逻辑上集中,物理上分散的计算机布局类型
在分布式数据库系统上,用户可以通过任意一台计算机访问其他计算机的数据
并且分布式数据库系统具有较高的安全性,任意一台计算机宕掉后都可以通过另外一台计算机进行登录(换句话说就是可以从任何一台计算机黑进整个系统是吧.......)
分布式数据库系统可以就近调用资源,例如两台计算机距离分别是10,50km,分布式数据库系统中就可以选择最近的计算机,减少通信的消耗,提升系统的性能
分布式系统适合不断增长的业务,服务器不够了就再装嘛
——————————————————————————————————
主从数据库
顾名思义,主是指主要数据库,从是指备份数据库,主从数据库不在同一个物理位置上
主从数据库的优点
1、方便做热备份,主服务器故障后可以切换到从数据库,避免数据丢失
2、业务量变大后,访问率会越来越高多库的存储,可以降低单个磁盘访问的频率,提高性能
3、读写分离,部分报表的SQL语句非常的慢,导致锁表,此时如果能够把两个数据库分开始使用,就不会造成锁表,保证了速度
主从数据库的架构方式
一从一主(对套)
一从多主(多用一)
多主一从(我寻思和上面好像差不多啊)
双主复制(互做复制)
级连复制(数据同步的情况下不连接主节点,而是连接从节点)
————————————————————————————
实操——部署主从数据库
改名
关selinux
防火墙
配置host文件(/etc/hosts)
配置yum源
安装数据库服务( yum install -y mariadb mariadb-server)
设置开机自启动
[root@mysql1 ~]# systemctl start mariadb
[root@mysql1 ~]# systemctl enable mariadb
初始化数据库并配置主从服务
mysql_secure_installation
出现错误
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
在按了几次回车后出现了以下提示
Set root password? [Y/n] t^Hy^H^Hy
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
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!
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!
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!
虽然不知道发生了什么,我这好像是把密码重新设置了
今天先到这里,配置文件已经保存