16 messages in com.mysql.lists.clusterFW: Create New Database in MYSQL cluster
FromSent OnAttachments
Tangirala, Srikalyan26 Feb 2007 13:30 
Mike Kruckenberg26 Feb 2007 13:33 
Tangirala, Srikalyan26 Feb 2007 13:36 
Mike Kruckenberg26 Feb 2007 13:40 
Jimmy Guerrero26 Feb 2007 13:44 
Tangirala, Srikalyan26 Feb 2007 13:47 
Jon Stephens26 Feb 2007 17:30 
Agarwal, Abhishek27 Feb 2007 06:11 
Tangirala, Srikalyan27 Feb 2007 06:39 
Agarwal, Abhishek27 Feb 2007 07:58 
Tangirala, Srikalyan27 Feb 2007 08:03 
Black, Ben27 Feb 2007 08:28 
Jon Stephens27 Feb 2007 15:43 
Stewart Smith28 Feb 2007 09:21 
Stewart Smith04 Mar 2007 11:51 
Stewart Smith04 Mar 2007 11:54 
Subject:FW: Create New Database in MYSQL cluster
From:Tangirala, Srikalyan (Srik@nortelgov.com)
Date:02/27/2007 06:39:50 AM
List:com.mysql.lists.cluster

-----Original Message----- From: Agarwal, Abhishek Sent: Tuesday, February 27, 2007 9:12 AM To: 'Jon Stephens'; Tangirala, Srikalyan Cc: 'Mike Kruckenberg'; 'clus@lists.mysql.com' Subject: RE: Create New Database in MYSQL cluster Importance: High

Hello Jon,

Thank you for a detailed email. I really appreciate your input in all respects. I think the question which Sri wanted to ask was that he wanted to check where the data is physically on the data nodes. We are aware of the command which you described but the reason why we asked this question was that when we try to check the data on data nodes and we didn't find any database file named on the example database which we created.

Another question which I wanted to ask you is that "How many minimum number of servers are required to create a true redundancy?" This includes redundancy for MGM node and SQL node also. Are there any restriction that Management/SQL node/ Data node cannot run of same machines?

Thank you again for your response and any future inputs.

Regards, -Abhishek.

-----Original Message----- From: Jon Stephens [mailto:jo@mysql.com] Sent: Monday, February 26, 2007 8:31 PM To: Tangirala, Srikalyan Cc: Mike Kruckenberg; clus@lists.mysql.com; Agarwal, Abhishek Subject: Re: Create New Database in MYSQL cluster

Tangirala, Srikalyan wrote:

Hello Mike,

Thank you and it did create the database. I looked into the Datanode A and tried to search for the table but was not able to see any table created. I was looking into the following directory on DATA node /usr/local/mysql/data

Use SHOW DATABASES to view a list of all databases on the server.

Use SHOW TABLES to view a list of tables in the current database.

Use SELECT DATABASE() to determine what the current database is.

Use SHOW TABLES FROM mydb to view a list of tables in the database named "mydb".

Use DESCRIBE mytable to view a list of columns and keys for the table named "mytable".

Use SHOW CREATE TABLE mytable to view the CREATE TABLE statement necessary to create the table named "mytable".

jon@gigan:/usr/local/mysql/bin> ./mysql -u jon Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.16-beta-debug Source distribution

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

mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | | world | | world_ndb | +--------------------+ 5 rows in set (0.01 sec)

mysql> CREATE DATABASE ndb1; Query OK, 1 row affected (0.38 sec)

mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | ndb1 | | test | | world | | world_ndb | +--------------------+ 6 rows in set (0.01 sec)

mysql> USE ndb1; Database changed

mysql> SELECT DATABASE(); +------------+ | DATABASE() | +------------+ | ndb1 | +------------+ 1 row in set (0.00 sec)

mysql> CREATE TABLE t1 (c1 INT) ENGINE=NDB; Query OK, 0 rows affected (1.02 sec)

# Note: ENGINE=NDB or ENGINE=NDBCLUSTER will work to create a Cluster # table. I'm lazy, so I use ENGINE=NDB. ;)

mysql> SHOW TABLES; +-----------------+ | Tables_in_ndb1 | +-----------------+ | t1 | +-----------------+ 1 row in set (0.01 sec)

mysql> SHOW TABLES FROM world; +-----------------+ | Tables_in_world | +-----------------+ | City | | Country | | CountryLanguage | +-----------------+ 3 rows in set (0.01 sec)

mysql> DESCRIBE t1; +-------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | c1 | int(11) | YES | | NULL | | +-------+---------+------+-----+---------+-------+ 1 row in set (0.08 sec)

mysql> SHOW CREATE TABLE t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 1 row in set (0.01 sec)

You really need to have a grasp of MySQL fundamentals before attempting to use MySQL Cluster.

See http://dev.mysql.com/doc/refman/5.1/en/tutorial.html for a tutorial that will help you get up to speed on some of this stuff.

cheers

jon.

Do let me know if I am looking at the right place.

Thank you, Sri

-----Original Message----- From: Mike Kruckenberg [mailto:mi@kruckenberg.com] Sent: Monday, February 26, 2007 4:41 PM To: Tangirala, Srikalyan Cc: clus@lists.mysql.com; Agarwal, Abhishek Subject: Re: Create New Database in MYSQL cluster

Tangirala, Srikalyan wrote:

Hello Mike,

Thank you for your response. I am not sure if I understand you correctly but I tried to create a table using the syntax you suggested and got the following output. Please suggest further.

mysql> CREATE TABLE example (a int NOT NULL, b int NOT NULL) ENGINE=NDBCLUSTER; ERROR 1046 (3D000): No database selected mysql> CREATE TABLE example (a int NOT NULL, b int NOT NULL) ENGINE=NDB; ERROR 1046 (3D000): No database selected

In order to create a table you need to have an active database. To make a database active issue a 'USE' statement:

CREATE DATABASE example; USE example; CREATE TABLE....