这是我第一次接触Linux,CentOS, MySQL,用了5天的时间终于将基于CentOS5.0系统下MySQL-Cluster架构成功,下面将我这些经验分享
前言:
这是我第一次接触Linux,CentOS, MySQL,用了5天的时间终于将基于CentOS 5.0系统下MySQL-Cluster架构成功,下面将我这些经验分享给大家。若发现有什么错误和疏忽之处,请发邮件给我: stan_home@qq.com。
(PDF图文版请下载地址: )
配置之前,先补充一些Linux常用命令:
ls 浏览
ls -l 查看文件夹及文件权限
vi 文本编辑器(搜索、编辑)
i 状态为修改
退出:“Esc”键后,然后输入":",然后输入“wq”写入、退出
:q! 强制退出
vim -f [文件名] 强制恢复文件
cp 拷贝文件命令
rm 删除文件
mkdir 创建文件夹
ln 连接问价或目录
man [命令] 查看命令参数
ifconfig 网卡信息命令
dig (域信息搜索器)
df 查看系统文件
vmstat 系统状态
ps 查看进程(-e显示全部,-f全格式输出)
ps -ef|grep mysql 查看所有mysql进程
Tips:输入一个文件或文件名,按一下Tab键,,会自动完成改文件名(前提是这个文件或文件夹必须存在);
例如:
输入
[root@localhost tmp]# tar –xzvf mysql-c
按一下Tab键自动完成:
[root@localhost tmp]# tar –xzvf mysql-cluster-gpl-7.1.13-linux-i686-glibc23.tar.gz
下面,我们一起来架构吧!
一、配置环境:
OS:Linux CentOS 5.0
MySQL: mysql-cluster-gpl-7.1.13-linux-i686-glibc23.tar.gz (注意:需用Cluster版本,可在官网上下载 )
节点配置情况:
MGM:192.168.20.231
NDBD1:192.168.20.232
NDBD2:192.168.20.233
SQL1:192.168.20.234
SQL2:192.168.20.235
修改CentOS IP地址
(1)打开/etc/sysconfig/network-scripts/ifcfg-eth0文件,做如下修改
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
HWADDR=00:0c:29:be:b3:53
IPADDR=192.168.20.231
NETMASK=255.255.255.0
GATEWAY=192.168.20.1
(2)修改/etc/resolv.conf文件, 如下(修改DNS服务)
nameserver 202.101.172.35
search localdomain
(3)重启网络服务
[root@localhost ~]# service network restart

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
