mysql ndb 测试_mysql8 参考手册-NDB群集的快速测试设置

为了使您熟悉基础知识,我们将介绍功能正常的NDB群集的最简单配置。之后,您应该能够根据本章其他相关部分提供的信息来设计所需的设置。

首先,您需要/var/lib/mysql-cluster通过以系统root用户身份执行以下命令来创建配置目录(例如) :

shell>mkdir /var/lib/mysql-cluster

在此目录中,创建一个名为的文件 config.ini,其中包含以下信息。用适当的值替换您的系统HostName并DataDir根据需要替换它 。

# file "config.ini" - showing minimal setup consisting of 1 data node,

# 1 management server, and 3 MySQL servers.

# The empty default sections are not required, and are shown only for

# the sake of completeness.

# Data nodes must provide a hostname but MySQL Servers are not required

# to do so.

# If you don't know the hostname for your machine, use localhost.

# The DataDir parameter also has a default value, but it is recommended to

# set it explicitly.

# Note: [db], [api], and [mgm] are aliases for [ndbd], [mysqld], and [ndb_mgmd],

# respectively. [db] is deprecated and should not be used in new installations.

[ndbd default]

NoOfReplicas= 1

[mysqld default]

[ndb_mgmd default]

[tcp default]

[ndb_mgmd]

HostName= myhost.example.com

[ndbd]

HostName= myhost.example.com

DataDir= /var/lib/mysql-cluster

[mysqld]

[mysqld]

[mysqld]

现在,您可以启动ndb_mgmd管理服务器。默认情况下,它尝试读取config.ini其当前工作目录中的 文件,因此将位置更改为文件所在的目录,然后调用ndb_mgmd:

shell>cd /var/lib/mysql-cluster

shell>ndb_mgmd

然后通过运行ndbd启动单个数据节点:

shell>ndbd

有关启动ndbd时可以使用的命令行选项 ,请参见 第22.4.31节“ NDB群集程序的公用选项-NDB群集程序的公用选项”。

默认情况下,ndbdlocalhost在端口1186上查找管理服务器。

注意

如果从二进制压缩包安装了MySQL,则需要明确指定ndb_mgmd和 ndbd服务器的路径。(通常,这些内容可以在中找到/usr/local/mysql/bin。)

最后,将位置更改为MySQL数据目录(通常为 /var/lib/mysql或 /usr/local/mysql/data),并确保my.cnf文件包含启用NDB存储引擎所需的选项:

[mysqld]

ndbcluster

现在,您可以照常启动MySQL服务器:

shell>mysqld_safe --user=mysql &

请稍等片刻,以确保MySQL服务器正常运行。如果您看到该通知mysql ended,请检查服务器的.err文件以找出问题所在。

如果到目前为止一切顺利,您现在就可以开始使用集群了。连接到服务器并验证NDBCLUSTER是否启用了 存储引擎:

shell> mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1 to server version: 8.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SHOW ENGINES\G

...

*************************** 12. row ***************************

Engine: NDBCLUSTER

Support: YES

Comment: Clustered, fault-tolerant, memory-based tables

*************************** 13. row ***************************

Engine: NDB

Support: YES

Comment: Alias for NDBCLUSTER

...

前面示例输出中显示的行号可能与系统上显示的行号不同,这取决于服务器的配置方式。

尝试创建NDBCLUSTER表:

shell> mysql

mysql> USE test;

Database changed

mysql> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;

Query OK, 0 rows affected (0.09 sec)

mysql> SHOW CREATE TABLE ctest \G

*************************** 1. row ***************************

Table: ctest

Create Table: CREATE TABLE `ctest` (

`i` int(11) default NULL

) ENGINE=ndbcluster DEFAULT CHARSET=latin1

1 row in set (0.00 sec)

要检查您的节点设置是否正确,请启动管理客户端:

shell>ndb_mgm

从管理客户端中 使用SHOW命令来获取有关群集状态的报告:

ndb_mgm> SHOW

Cluster Configuration

---------------------

[ndbd(NDB)] 1 node(s)

id=2 @127.0.0.1 (Version: 8.0.20-ndb-8.0.20, Nodegroup: 0, *)

[ndb_mgmd(MGM)] 1 node(s)

id=1 @127.0.0.1 (Version: 8.0.20-ndb-8.0.20)

[mysqld(API)] 3 node(s)

id=3 @127.0.0.1 (Version: 8.0.20-ndb-8.0.20)

id=4 (not connected, accepting connect from any host)

id=5 (not connected, accepting connect from any host)

至此,您已经成功设置了一个正常工作的NDB集群。现在,您可以使用使用ENGINE=NDBCLUSTER或其别名ENGINE=NDB创建的任何表将数据存储在集群中。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Create and run a real-time, highly-available, and high-redundancy version of the world's most popular open-source database, MySQL. You will understand the advantages and disadvantages of the MySQL NDB Cluster solution, and when MySQL NDB Cluster is the right choice. Pro MySQL NDB Cluster walks you through the full lifecycle of a MySQL Cluster installation: starting with the installation and initial configuration, moving through online configuration and schema changes, and completing with online upgrades. Along the way, you will learn to monitor your cluster, make decisions about schema design, implement geographic replication, troubleshoot and optimize performance, and much more. This book covers the many programming APIs that are supported by MySQL NDB Cluster. There's also robust coverage of connecting to MySQL NDB Cluster from Java, SQL, memcached, and even from C++. From any of these languages, you'll be able to connect and store and retrieve data as your applications demand. The book: Covers MySQL NDB Cluster concepts and architecture Takes you through the MySQL NDB Cluster lifecycle from installation to upgrades Guides you through DBA and Developer decisions when working with MySQL NDB Cluster What You'll Learn Understand the shared-nothing architecture behind MySQL NDB Cluster Plan, install, and configure a MySQL NDB Cluster environment Perform everyday tasks such as backing up, restoring, and upgrading Develop applications from Java, memcached, C++, and SQL Troubleshoot and resolve application performance problems Master enterprise-level features such the MySQL NDB Cluster Manager Who This Book Is For Database administrators and developers who are looking into deploying MySQL NDB Cluster, or who already have a cluster in production and want to increase their knowledge and ability to handle routine administrative tasks and troubleshooting. The book also is for those developers wanting to employ MySQL NDB Cluster as their chosen storage engine from Java, memcached, and C++ applications. Table of Contents Part I: The Basics Chapter 1: Architecture and Core Concepts Chapter 2: The Data Nodes Part II: Installation and Configuration Chapter 3: System Planning Chapter 4: Configuration Chapter 5: Installation Chapter 6: Replication Part III: Daily Tasks and Maintenance Chapter 7: The NDB Management Client and Other NDB Utilities Chapter 8: Backups and Restores Chapter 9: Table Maintenance Chapter 10: Restarts Chapter 11: Upgrades and Downgrades Chapter 12: Security Considerations Chapter 13: MySQL Cluster Manager Part IV: Monitoring and Troubleshooting Chapter 14: Monitoring Solutions and the Operating System Chapter 15: Sources for Monitoring Data Chapter 16: Monitoring MySQL NDB Cluster Chapter 17: Typical Troubles and Solutions Part V: Development and Performance Tuning Chapter 18: Developing Applications Using SQL with MySQL NDB Cluster Chapter 19: MySQL NDB Cluster as a NoSQL Database Chapter 20: MySQL NDB Cluster and Application Performance Tuning
### 回答1: MySQL动物信息管理系统是一个使用MySQL数据库和Java编程语言开发的动物园信息管理系统。该系统可以帮助动物园管理员管理动物信息,包括动物种类、数量、饲养情况等。 胖子是一个由淘宝开发的分布式数据库中间件,可以将多个MySQL数据库组成一个分布式数据库集群,提供高可用性、高并发性和可扩展性。MySQL NDBMySQL提供的一种高可用性、高性能的分布式数据库存储引擎,也可以用于构建分布式数据库集群。 在使用MySQL动物信息管理系统时,可以选择使用胖子或MySQL NDB来构建分布式数据库集群,以提高系统的可用性和性能。具体选择哪种方案需要根据实际情况进行评估和比较,包括数据量、访问量、负载情况、可用性要求等因素。 ### 回答2: MySQL动物信息管理系统是一个用于管理动物园内动物信息的系统。管理员通过该系统可以轻松地查看、添加、编辑和删除园内动物的相关信息。在这个系统中,MySQL NDB(Network DataBase)被用作数据库引擎。 MySQL NDBMySQL的一种特殊的存储引擎,它特别适用于高可用性和高可扩展性的应用场景。相比其他存储引擎,MySQL NDB具有更好的数据复制和分区能力,并且可以在不同的服务器上实现数据的同步和共享。对于一个动物园管理员来说,MySQL NDB的特性对于动物信息管理系统非常有用。 首先,由于动物园中的动物信息是实时更新的,管理员需要能够及时地获取最新的信息。而MySQL NDB可以实现数据的实时同步和复制,在多个服务器上保持数据的一致性和即时性。这意味着管理员可以在任何时间和任何地点访问到最新的动物信息。 其次,动物园中的动物数量可能非常庞大,而MySQL NDB拥有良好的可扩展性。它可以以分布式集群的形式运行,将数据分片存储在多个节点上,并实现负载均衡和故障恢复。这就意味着即使在大规模的动物信息管理系统中,MySQL NDB也能保持良好的性能和可靠性。 最后,由于管理员可能需要进行复杂的查询和统计操作,MySQL NDB的分区功能可以使数据库更加高效。管理员可以根据动物的种类、栖息地、饲养情况等因素进行分区,从而提高查询速度和效率。此外,由于MySQL NDB支持并行查询处理,在高负载情况下可以更好地处理管理员的请求。 总之,MySQL NDB作为动物信息管理系统的数据库引擎,具有高可用性、高可扩展性和高效率的特点,能够帮助管理员轻松地管理动物园内的动物信息。 ### 回答3: MySQL动物信息管理系统是一个用于管理动物园基本信息的数据库系统。管理员可以通过该系统进行动物的录入、查询、更新和删除等操作。 在管理员使用MySQL NDBMySQL Cluster)作为数据库引擎时,会有一些与传统MySQL数据库不同的特点和优势。 首先,MySQL NDB是一个分布式数据库引擎,能够将数据库分布在多台计算机上,实现高可用性和容错性。这对于动物信息管理系统来说是非常重要的,因为即使其中一台计算机发生故障,系统仍然可以继续正常运行,管理员可以继续对动物信息进行管理。 其次,MySQL NDB支持数据库的自动分片(sharding)和自动数据重分布。这意味着当数据库的数据增长超过一台计算机的处理能力时,管理员无需手动进行数据分片和迁移操作,系统会自动将数据分散存储在多台计算机上,以平衡负载,并在需要时对数据进行重分布。 此外,由于MySQL NDB采用了内存数据库(in-memory database)的设计思路,因此具有非常高的读写性能,适合处理大量的并发请求。在动物信息管理系统中,管理员可以通过MySQL NDB迅速查找和修改动物信息,使系统响应更加迅捷。 然而,MySQL NDB也存在一些限制。例如,MySQL NDB不支持某些传统MySQL数据库提供的功能,如全文搜索和外键约束等。管理员在设计和开发动物信息管理系统时需要考虑到这些限制,并根据实际需求进行权衡和选择。 总的来说,MySQL NDB作为数据库引擎对于动物信息管理系统来说是一种可行的选择,能够提供高可用性、容错性和良好的性能。管理员可以通过合理使用MySQL NDB的特性和优势来设计和实现功能完善的动物信息管理系统。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值