虚拟机环境中安装ubuntu下的mysql-cluster7.3.2(单点服务器)_MySQL
Ubuntu
bitsCN.com虚拟机环境中安装ubuntu下的mysql-cluster7.3.2(单点服务器)
部署环境:
系统:ubuntu-12.04.2 LTS -server-i386.iso
Cluster:mysql-cluster-gpl-7.3.2-linux-glibc23-i686.tar.gz
说明:
1、最好不要装Mysql(此处cluster为二进制版本)
2、chkconfig需要另外安装 且需另外装libaio1 来解决libaio.so.1无法找到的问题,当安装mysql时需要安装该组件
本次只准备进行单点连接,由于前两天都没有解决多点的问题,不断的发现问题,今天终于在http://www.bitsCN.com/database/201308/234120.html文章中得到启发,所以成功了,特对文章作者表示感谢。但是该文章并没有解决所有问题,所以这是所有解决问题的版本。
Mgm节点:192.168.131.11
Data节点:192.168.131.12
SQL节点:192.168.131.13
(一)安装管理节点
1、解压文件sudo tar -zvxf mysql-cluster-gpl-7.3.2-linux-glibc23-i686.tar.gzsudo mv mysql-cluster-gpl-7.3.2-linux-glibc23-i686 mysqlc2、创建安装目录sudo mkdir -p /home/lwprain/ndbdatasudo cd mysqlcsudo cp bin/ndb_mgmd /usr/local/binsudo cp bin/ndb_mgm /usr/local/bin3、配置日志文件存储目录sudo mkdir /var/lib/mysql-cluster4、创建配置文件目录及文件sudo touch config.inisudo nano config.ini
==================配置文件内容===================[ndbd default]NoOfReplicas=1 #复制成员个数DataMemory=80M #数据存储可以分配的内存IndexMemory=18M #索引存储可以分配的内存 [ndb_mgmd] #定义管理节点的IP地址或主机名nodeid=1HostName=192.168.131.11DataDir=/var/lib/mysql-cluster [ndbd] #定义数据节点nodeid=11HostName=192.168.131.12DataDir=/home/lwprain/ndbdata [ndbd][mysqld]#定义SQL节点nodeid=21HostName=192.168.131.13====================================================
(二)安装数据节点
解压文件sudo tar -zvxf mysql-cluster-gpl-7.3.2-linux-glibc23-i686.tar.gzsudo mv mysql-cluster-gpl-7.3.2-linux-glibc23-i686 mysqlc创建安装目录mkdir -p /home/lwprain/ndbdata拷贝执行文件cp mysqlc/bin/ndbd /usr/local/bin创建配置文件:sudo nano /etc/my.cnf分别在主机添加如下内容:[mysql_cluster] #配置数据节点连接管理节点ndb-connectstring=192.168.131.11
(三)安装SQL节点
解压文件tar -zvxf mysql-cluster-gpl-7.0.37-linux-glibc23-i686.tar.gzsudo mv mysql-cluster-gpl-7.0.37-linux-glibc23-i686 mysqlc添加mysql用户groupadd mysqluseradd -g mysql mysql添加权限chown -R mysql:mysql /home/lwprain/mysqlc拷贝配置文件cp /home/lwprain/mysqlc/support-files/my-default.cnf /etc/my.cnf初始化数据库cd /home/lwprain/mysqlcscripts/mysql_install_db --user=mysql拷贝守护进程所需文件cp /home/lwprain/mysqlc/support-files/mysql.server /etc/init.d/mysqld配置守护进程这要要首先安装chkconfigsudo apt-get install chkconfigchkconfig –add mysqldchkconfig –level 35 mysqld on更改配置文件vi /etc/my.cnf
分别编辑如下信息:
[mysqld] #配置SQL节点与管理节点连接port = 3306socket = /tmp/mysql.sockndbclusterndb-connectstring=192.168.131.11
(四)启动及关闭Cluster
启动循序:管理节点--->数据节点--->SQL节点
1,启动管理节点cd /usr/local/bin/ndb_mgmd -f /home/lwprain/config.inindb_mgm(查看节点连接情况)2,启动数据节点/usr/local/bin/ndbd --initial(第一次启动是用这个命令)/usr/local/bin/ndbd(以后用这个命令)3,启动SQL节点/home/lwprain/mysqlc/bin/mysqld_safe --user=mysql &
bitsCN.com

In database optimization, indexing strategies should be selected according to query requirements: 1. When the query involves multiple columns and the order of conditions is fixed, use composite indexes; 2. When the query involves multiple columns but the order of conditions is not fixed, use multiple single-column indexes. Composite indexes are suitable for optimizing multi-column queries, while single-column indexes are suitable for single-column queries.

To optimize MySQL slow query, slowquerylog and performance_schema need to be used: 1. Enable slowquerylog and set thresholds to record slow query; 2. Use performance_schema to analyze query execution details, find out performance bottlenecks and optimize.

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

MySQL asynchronous master-slave replication enables data synchronization through binlog, improving read performance and high availability. 1) The master server record changes to binlog; 2) The slave server reads binlog through I/O threads; 3) The server SQL thread applies binlog to synchronize data.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

The installation and basic operations of MySQL include: 1. Download and install MySQL, set the root user password; 2. Use SQL commands to create databases and tables, such as CREATEDATABASE and CREATETABLE; 3. Execute CRUD operations, use INSERT, SELECT, UPDATE, DELETE commands; 4. Create indexes and stored procedures to optimize performance and implement complex logic. With these steps, you can build and manage MySQL databases from scratch.

InnoDBBufferPool improves the performance of MySQL databases by loading data and index pages into memory. 1) The data page is loaded into the BufferPool to reduce disk I/O. 2) Dirty pages are marked and refreshed to disk regularly. 3) LRU algorithm management data page elimination. 4) The read-out mechanism loads the possible data pages in advance.

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment