MySQL Cluster + Manager and NDB/J - mysql

I've been trying to setup a MySQL Cluster for a few days using the MySQL Cluster Manager on 3 Ubuntu nodes (3 identical VM instances with 1GB RAM each).
I've followed the video on MySQL Cluster Manager on the MySQL site. There's not much other documentation/tutorials on it (probably because it's a commercial product).
I start the cluster and show the status, but the mysqld nodes never start, they just remain as "added". If I install mysql-server using "sudo apt-get install mysql-server" then I get the normal local server running and the nodes register as "started", but I can't see how to connect to the cluster rather than the individual MySQL servers running on the mysqld nodes.
I'm also at a loss as to how the Java connector for MySQL Cluster is organised, it appears that there are multiple libraries so I don't even know which library I need or how to get them (some are created when compiling MySQL Cluster???). Could someone please explain how the connectors work to interact with NDB from Java and how to get them?
Thanks for any answers.

First of all, the official documentation for MySQL Cluster Manager can be found by navigating to the Cluster documentation on dev.mysql.com (called "MySQL Cluster Manager"). You are correct that MySQL Cluster Manager is commercial software although MySQL Cluster itself is available under a commercial or GPL license.
It sounds as though you've already configured the agents and have them running and so if you want to get a Cluster up and running quickly then refer to this simple worked example of using MySQL Cluster Manager
In terms of understanding why the MySQL Servers (mysqlds) are not starting up, there aren't many clues in your question and so we need to narrow it down (one reason could be if you had multiple mysqlds defined on the same host that are trying to use the default port (3306)).
To check what the manager has been doing, take a look in the file called mysql-cluster-manager.log. You can adjust the level of logging using the cluster manager configuration file.
To see what MySQL Cluster itself thinks has happened, check the directories storing the cluster data files (if you haven't over-written the defaults then this would be under /clusters/ and then you'll see a directory for each node in the cluster). The first one to check is ndb__cluster.log and other logs that you'll find in the "data" sub-directory of the id associated with the ndb_mgmd node. There will also be per-node log files so also check the mysqld_out.err and mysqld_out.log files stored in the data directory associated with mysqld node-ids.
Most important point is do not use the mysqld that gets installed with "sudo apt-get install mysql-server" as this version will not be compatible with MySQL Cluster - always use the binaries that come with the MySQL Cluster tar ball (or if using Cluster Manager that should be transparent to you anyway.
Note that if you want to get MySQL Cluster up and running on a single host without MySQL Cluster Manager then refer to the quick-start guide located on the MySQL Cluster download site (on mysql.com rather than e-Delivery).
For the java access, try out this MySQL Cluster ClusterJ tutorial.

Related

Convert single MariaDB to a Galera Cluster

I have the next question that I don't know how to solve.
I currently have a server running mariadb version 10.1 on a Debian 9.8. This server is for test environments so it is not a real production environment.
Now I need to create a cluster using a gallery to have two nodes. I already have the second server mounted, but I don't know what are the steps to configure the Galera cluster of a node with databases already created and with information and with another node completely from scratch. What would be the steps and what should be done?

MySQL read replica on Mac with Homebrew

I've recently started using AWS Aurora to take advantage of the improvements over standard MySQL. I have a REST API running that connects either to the main cluster endpoint, or the read endpoint if the request will only perform SELECTs. Obviously I want to test this locally so that I don't mark any routes as read only if they're not.
I installed mysql with Homebrew and have it running as a service. What I need to do now is have another mysql instance running on a different port, and then set up read replication between my original instance and the new one.
Does anyone have any idea how I go about this?

migrate samba domain to CTDB

I am trying to migrate samba domain controller (version 3.6, passdb backend = tdbsam) to a new clustered environment with CTDB (same samba version).
I have a functional ceph storage and the ctdbd configured according to the documentation.
However, all available guides are for the fresh installations and I can't migrate current data into the CTDB.
Simply restoring tdb database into the CTDB doesn't work and it ends with the following error:
2015/05/25 22:25:04.849302 [ 5636]: Invalid version of database dump.
File is version 7308332182664266836 but expected version was 1
Converting tdb database with ltdbtool doesn't bring any joy too.
How to import tdb samba databases into the ctdb?
Thanks,
Marko
Firstly a few words of warning: It is not common to cluster a domain controller with CTDB. Clustering/CTDB is made for file servers which are usually member servers in a domain. The domain controller's primary purpose is to offer logon services for the clients and usually different replication services are used (e.g. storing the DB in ldap instead of TDB). Clustering a domain controller can be problematic since the whole cluster needs to present itself consistently as a single server to the clients. This may pose problems with nmbd / NetBIOS name resolution. Furthermore, one problem is that you need to make sure in the cluster that all underying user accounts are created on all ctdb cluster nodes with the same user IDs.
Generally, it is best practice to separate file servers roles from domain controller roles as much as possible. Also keep in mind that starting with Samba 4.0 there is now the functionality of a Active Directory domain controller which comes with multi-master replication of the user database at the protocol level.
All that being said, the important bit is that you can not freely replace samba and ctdb versions. Samba 3.6 should work with ctdb 2.5, but Samba needs to be recompiled against the ctdb version to be used. I.e. if Samba has been compiled against an older version of CTDB (like 1.0.114.X), then this binary package won't work with CTDB 2.5.
If you have a working set of samba and ctdb packages, then the process of migrating a previous install into this new install depends on whether the previous install was also a CTDB-cluster. If so, you can do
ctdb getdbmap
on the old install and then run
ctdb backupdb
on all databases marked PERSISTENT. On the new install you use
ctdb restoredb
to restore all these DBs.
If the previous install is a non-clustered Samba, then your hint to use ltdbtool is correct. You have to
copy the important databases off the old install, at least:
secrets.tdb
passdb.tdb
winbindd_idmap.tdb
group_mapping.tdb
account_policy.tdb
share_info.tdb
convert them to ctdb format with ltdbtool
make sure ctdb is OFF on all nodes
copy the converted dbs to /var/lib/ctdb/persistent/ on node number 0 suffixing the file name with .0 e.g. `/var/lib/ctdb/persistent/secrets.tdb.0'
start ctdb on node 0
start ctdb on all other nodes
after that, the these DBs should be in sync on the cluster.

MySQL Should the connection shown in Workbench read “Local instance MySQL57” or “MySQL57”?

Specific Question: In a 2-3 week process of learning MySQL and attempting to get a Python stock info scrapping program to feed data into a MySQL schema (database, table) I’m having serious difficulties with connections. Having been bitten by doing something wrong & having to re-install MySQL about 8 times now, I’m getting rightfully leery of just about everything in the installation process. Thus this question:
Is “Local instance MySQL” which shows up in the upper left corner of the first (black) MySQL Workbench screen the proper one to use to connect to the database?
As a follow-up,
What is the difference between the windows service MySQL57, the connection MySQL57, and Local instance MySQL57?
During the very painful process of trying to get MySQL up and running, I think I've gotten further when with a fresh installation the first screen reads “MySQL57” as opposed to “Local instance …”
My setup parameters are pretty vanilla with the exception that I’m putting the MySQL program on my D: drive as opposed to the C: drive (an SSD reserved for the operating sys).
System: Windows 8 64bit on a Xeon Ivy Bridge processor, large SSD’s, large HD’s, mucho RAM, dual X-fired video cards, ASUS Sabertooth MB (self-built a yr ago)
Software: MySQL 5.7, complete installation except for module for Visual Basic and Python3 (running 2.7). Attempting to use the above hardware as both a server & client.
Even though I did my first Fortran programming in 1964, and spent my career on Unix machines, please regard me as a newbie when it come to the jargon associated with databases and client/server communications.
Why am I asking this question? My “down the road question” will be about getting data from Python into the MySQL table, but “first things first” --- I would like to get a nice clean installation that I can trust.
By the way, I’ve thoroughly scoured this site and many others but have not found any answers that fit my requirements; they’re either for a non-Windows environment, too full of jargon for me to understand, or too simplistic to be useful.
TIA, Doug
Seems there's some confusion about certain terms. So let's have a look at each:
MySQL is a server application that you can install and connect to via
TCP/IP (on any platform), named pipes (on Windows) or sockets (on
*nix like platforms). This server is totally independent and has no name or such for identification.
A Windows service to run the MySQL server: this is just a helper to allow running the server when your machine starts up. A service is not strictly necessary to run a MySQL server but without it you would have to manually start/stop the server. You can create as many service entries for a server as you want, but usually it makes no sense to create more than one. Since there can be more than one server (each with an own service) on the box it is highly recommended to give the services speaking names (like MySQL57 for a 5.7 MySQL server, MySQL56 or a 5.6 server etc.).
MySQL Workbench connections are entries that store parameters to connect to a MySQL server. They are not tied to a specific service in general (you can connect to a non-Windows server too), but might be associated with such a service if they are configured for a local server (on a Windows machine) and you want to be able to start/stop this server from within MySQL Workbench (see Administrator section). They use the service name to act on a particular service (you configure that in the Connection manager, System profile). On Windows MySQL Workbench attempts to find installed service (to help new users to get up and running quicker) when it is started and no connection is currently defined. It then automatically creates a connection for each service it found (it uses "mysql*" as pattern to search for services). You can retrigger this process by removing all connections and restart MySQL Workbench.
The created connnections (like the “Local instance MySQL”) appear as tile you can simply click to open that connection. Be aware that clicking on the rightmost 1/4 of the tile will open an information popup only, not open the connection as such.
Now to your question:
What is the difference between the windows service MySQL57, the
connection MySQL57, and Local instance MySQL57?
I don't understand where you see a connection MySQL57. There's usually only a service MySQL57 and connection in MySQL Workbench to the server this service is for involved.
I'm also not sure why this is such a dreadful process for you. Especially for Windows a lot of effort has been put into an easy installation experience. The normal process should be like:
Download the MySQL Installer
Run the installer. Select a typical scenario from the presets or select the individual products you want to have installed, say, a MySQL server + MySQL Workbench.
The installer will download and install the selected components.
Configure your server (like giving it a proper service name, TCP/IP port etc.).
After finishing the installer you start MySQL Workbench and can immediately work with your new server (as described above MySQL Workbench picks up the service automatically).
Depending on your download speed this should be something like a 5 - 10 mins. process.
HTH
with due respect sir , windows service mysql is a service created by windows upon successful to help you start / stop mysql. You can use Local Instance Mysql57 without a glitch, as that is just a way of MySQL representing your local mysql instance in the workbench.

How To start multiple mySQL instances on boot

I currently have 3 mySQL instances on my Linux Centos 64 bit server. When the server boots up it only starts the first mySQL instance. At that point I have to "mysqld_multi stop" then "mysqld_multi start" to ensure all 3 are started. Is there anyway Linux can start all 3 up at run time so I don't have to do this every time I reboot the server.
you can use crontab #reboot option:
http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5
After researching this a little bit, it looks like you don't have too many options and they aren't as elegant as I would like.
Creating a separate mysql server instance
Running Multiple MySQL 5.6 Instances on one server in CentOS 6/RHEL 6/Fedora
This link explains pretty well how to create another MySQL server instance that starts at boot time. You could definitely do things better than he describes, but this is a start. Essentially he copies the /etc/init.d/mysqld startup script and the /etc/my.cnf configuration file and has the new startup script reference the new configuration file.
Creating a unified startup script
You could also chkconfig mysqld off to not use mysql's built-in startup script and create your own that runs your mysqld_multi commands at boot time.
Let me know if you are looking for more information.