Sunday, June 20, 2010

Running MySQL Cluster as a Service on Windows

The MySQL Cluster daemon for MySQL Cluster (ndbd and ndb_mgmd) doesn't by themselves yet let them run as a service (apparently ndb_mgmd does, but I haven't seen it documented anywhere on how to do that). But there are ways to fix this, using some simple Windows tools and some registry hacking.

What you need to find is the Windows Resource Kit from some version of Windows that includes instsrv.exe and srvany.exe. It is not too picky with the actual version of Windows you run it seems, I used the Windows NT 32-bit versions of these on a 64-bit Windows 7 box, and it works just fine.

These two programs are simple and are easy to use:
  • instsrv allows you to install a service, it's real simple, just run the program and it will show the options (and these are few).
  • srvany allows you to run any odd program, that is not intended run as a service, do do this anyway.
Now, Google a bit and download these two puppies and open a DOS Window and change directory to where you installed these guys. Now we are realy to install three services (1 for the mgm and two datanodes), so they will run the srvany program:
F:>ResKit> instsrv mgm1 F:\ResKit\srvany.exe
F:>ResKit> instsrv ndbd1 F:\ResKit\srvany.exe
F:>ResKit> instsrv ndbd2 F:\ResKit\srvany.exe

These three services are rather boring now, they do not do anything, really. To fix this, open the registry editor (regedit) and open:
Now, we need to define what srvany.exe should run. In the key above, create a new key called Parameters. In this key then, create two values of the type REG_SZ:
  • Application - The full path to the program srvany should run.
  • AppParameters - The parameters to pass to the program srvany will run.
In my case, I set these to, for the mgm service:
Application: F:\MySQL714\bin\ndb_mgmd.exe
AppParams: --config-file=F:\MySQL714\mgm1\config.ini --configdir=F:\MySQL714\mgm1

I think you see where I'm going with this, but just to be sure, this is what I set for the ndbd1 service:
Application: F:\MySQL714\bin\ndbd.exe
AppParams: --ndb_connectstring=nodeid=2;host=localhost:1186

And that's it, folks! Well, one more thing I guess, we want to install the MySQL Server as a serive also, but this knows how to install itself as a service and can also run nicely as a service, so this is easy:
F:\ResKit>F:\MySQL714\bin\mysqld --install MySQL714 --defaults-file=F:\MySQL714\my.ini

Make sure that the ini-file for the MySQL server is configured to access the cluster we just set up, and to have the ndbcluster engine enabled (for some reason, the latter is not enabled by default). Do this by editing the my.ini file used by the server (and referenced above) and add the following two lines to the [mysqld] section:

Now we have created and configured a bunch of services for a MySQL Cluster setup, and to try it out, lets start them using the NET command line program (the SC command may also be used):
F:\ResKit> net start mgm1
F:\ResKit> net start ndbd1
F:\ResKit> net start ndbd2
F:\ResKit> net start MySQL714

Have fun! And just a word of caution: Although this works just fine for testing, note that shutdown of the ndbd and mgm services isnt really graceful here, so this is just for fun and testing. Also, ndbd and ndb_mgmd will sure be possible to run as a Windows service in their own right, in some future version of MySQL Cluster.



Jan said...


you should check the "sc" (Service Control) command, as it can be used to create, delete and control service on Windows Systems out of the box.


Karlsson said...

True, but this still assumes that the prograns are services enabled. So the SC command could do away with instsrv and net, but not, as far as I can tell, srvany.

James said...

I would like to say that you really made my day, it's wonderful when you just look around the web
and find something like this, reminds me of that ''How to make a dinner for a romantic...'' by Elsa Thomas,
you're a wonderful writer let me tell you!!! ñ_ñ

Buy Viagra
James Maverick (
3453 Rardin Drive
San Mateo, CA 94403
Project Manager

Alex said...

I like to use MySQL Cluster daemon for MySQL Cluster service. I heard about this service that it is very good. Thanks a lot for sharing this information.


online viagra

Penis Enlargement Pills said... is an all-natural Penis Enlargement, safe, and guaranteed alternative to painful and dangerous Penis enlargement methods such as surgery, straps, or rings.
penis enlargement pills or male enhancement pills will immediately boost your performance, improve your orgasms, and increase the penis size within just a few weeks!


Best Penis Enlargement Pills said...

We just wanted to share information about best penis enlargement that are busy talking about people who want a bigger penis size, stronger and able to increase stamina.
Penis Enlargement Pills
Top Penis Enlargement Pills
Method Penis Enlargement Pills

Suraj45 said...

I have wanted to learn more about particular topics, but not many websites would help me out in informing me the way I expected. This left me with many question, but after reading your article, I got an answer to all my questions. You are too cool dude!!!

valentines day ideas

Generic Viagra

jackanderson said...
This comment has been removed by the author.
Raffay said...

Wow Impressive! Your blog is very informative. However, it is pretty hard task but your post and experience serve and teach me how to handle and make it more simple and manageable.Thanks for the tips… Best regards.

cheap reseller hosting |
cpanel reseller

Josh said...

Vimax is reliable stuff to accomplish your sexual dysfunction. It has been proven by many men to augment virility and genital.

Jason Smith said...
This comment has been removed by the author.
Joshua said...

hey thanks for the information.. it has been of great use .. it updating more post..thanks..


Sinan said...

Thanks so much for this! This is exactly what I was looking for bedava chat - islami chat - islami sohbet - sohbet siteleri - dini sohbet - mynet sohbet - sohbet odaları - garanti arkadas - sohbet kanallari - mirc sohbet - chat siteleri - mirc script indir - sohbet odaları - cinsel muhabbet - cinsel sohbet - Sex chat - seviyeli sohbet - kameralı sohbet - sohbet et - cinsel sohbet - sex sohbet - mirc - mirc indir - kameralı mirc - turkce mirc - sohbet siteleri - cet - chat kanali - chat kanalları - sohbet kanali - sohbet kanalları - Video izle - izmir sohbet - kaliteli sohbet - seviyeli chat - sesli sohbet

buy vicodin online said...

I have been looking for sites like this for a long time. Thank you! buy vicodin online

buy codeine online said...

I wanted to thank you for this great read.I am very pleased to find this site.
Thanks for sharing!
buy codeine online

mark said...

best organic seo servicesVery interesting thanks. I believe there's even more that could be on there! keep it up

jenifer said...

Cool blog I loved reading your info..
buy xanax online

Natasha said...

i am also loving your blog for sharing fantastic topic thanks for sharing keep it up.

Free Classified Ads

savsuns said...

Before reading this I was totally unaware of the topic. Thanks for Explaining in such a nice way. As per my knowledge there some buy lasix which are effective and good. I always prefer them only.

saim said...

I like the valuable information you provide in your articles. I’ll bookmark your weblog and check again here frequently. I am quite sure I will learn many new stuff right here! Best of luck for the next!

best over the counter sleep aid

amhash said...

Thanks for sharing such a useful information.Business Logo Design I was just surfing on internet and found your blog after reading this i realize that i should come here often.

Loraine Karins MLB BLOG said...

True, but this still assumes that the prograns are services enabled. So the SC command could do away with instsrv and net, but not, as far as I can tell, nfl jerseys
cheap mlb jerseys

Jack Harry said...

I am hoping that by my next post here, I will have the links up to Book Locker, as well as Amazon, where this new novel will be available for sale.
Dissertation Samples

john beeter said...

I like to use MySQL Cluster daemon for MySQL Cluster service. I heard about this service that it is very good. Thanks a lot for sharing this information.

Tatjana Cvetko said...

True, but this still assumes that the prograns are services enabled. So the SC command could do away with instsrv and net, but not, as far as I can tell, srvany
izdelava spletnih strani
Izdelava spletne trgovine
optimizacija in izdelava spletnih strani
gostovanje in izdelava spletnih strani

Pervez Joarder said...

I actually love a connecting technique with you plus unquestionably can come in the near future by time frame you are going to entire a further write-up. At this moment please click here Check Cashing Carson With thanks to get awesome information and facts.