We have an existing high traffic PHP web app which uses the MySQL Native driver's load balancing facility to split read & write queries between a master and slave database.
I'm migrating the API part of this app to NodeJS, currently I'm using the MySQL drivers.
My question: is there a way to split read write queries between master and slave databases in NodeJS? I've looked for a NodeJS version of the MySQL Native drivers but have had no luck as yet.
Thanks in advance for any help provided :)
Related
I have developed a billing application using grails3. Requirement is to use this application both online and offline, when internet facility interrupted, While using offline data is being stored in local Mysql db and when I switch to online, the offline Mysql data should be updated to my remote Mysql db. What is the best strategy to implement this use-case. Is there any grails-plugin available for this scenario.
One of my friends suggested the following use-cases to consider:
If you assume the amount of time the system is going to be offline is fairly low, you can hold the data in-memory and push when the system is back online.
If you think the data can get large with offline storage, you can use a FLAT File to store your data and then read that file and do the writes in your remote mysql db.
You can also use mysql replication capabilities to replicate your data and have both local and remote mysql instances. You will have to invest some time on how to do this.
Use a message queue mechanism to queue your queries when offline and then write to remote db in same sequence when online.
Use a in-memory or local h2 database If your sql queries are not too complex. Write a job that periodically writes to your remote instance.
I have installed ejabberd on an AWS EC2 instance and am using the smack library to connect to it with my android app. At the moment the ejabberd server is using mnesia as the database, however I want to perform some complex queries on some of the data (mainly the MUC room names), as SQL will predominantly the best solution for this, I was wondering if it was possible to replicate the required data to an external MySQL database that I could then query.
Is this possible or am i better looking at a different approach to this problem?
There is no module built into ejabberd to replicate data in Mnesia to MySQL. However, the usual approach is to use the backend you need for each feature. If you want mod_muc to store data into MySQL instead of Mnesia, you can just change the backend to odbc (which means it will store data for that module in a relational database).
You can refer to ejabberd documentation for MUC module: http://docs.ejabberd.im/admin/guide/configuration/#modmuc
Once your MySQL is configured and schema is loaded, you can set db_type to odbc on a case by case basis to choose MySQL for that module.
Ive just recently learned SQL. There seems to be a few concepts I cant understand. Please check my statements. SQL is a language you are using to access data in MySQL? MySql is a software for a database server? So this means you can buy your own computer hardware and install MySql there and you can access your files in that specific hardware? Or is MySql only installed in hardwares owned by Oracle and you can only access files there by registering in Oracle?
Here is an example please correct the statement. Im trying to build a website for my students that take in a username and password. This website will use a scripting language that will connect to a database server. So I upload my xhtml, css files, and some scripting language to a webhost. Then those scripting files will connect me to my database server? This means I should have a database server. The database server are MySql, Appache Cassandra. To connect to those database server do I need my own harver server that has these database server installed or do I obtain membership from Oracle(?), Appache(?) to access there database server or is there other ways to store data? I think you guys can see my confusion.
You could say SQL is a standardized language to work with relational databases like MySQL, SQL Server Oracle, PostgreSQL etc They conform more or less to the standardized SQL language
MySQL is open source you can install it on just about any major OS / hardware architecture, for free you don't have to pay anyone anything except for support if you require that
It's possible to host your database on a server and allow remote apps to connect to it.
Apache Cassandra isn't exactly a relational database.
The first thing you need to do is learn to use Google to search for answers to your basic questions. I also recommend Wikipedia.org.
Those two websites can help you learn about what SQL is, MySQL is, scripting languages are, and what servers are.
I'll throw you a bone here. MySQL, PHP, and Apache (1 "p", not 2) are all free software. You can install them on "Windows" or "Linux".
If you're running Windows, also try using Google to research "WAMP stack" or "WAMP".
I'm building a rails 3.1 app that requires a load of data to be crunched and processed on a local server (using a bunch of non-rails tools and writing to mysql) and then for the refined results to be punted up to a heroku production server (front end). because the data crunching aspect of the process needs to be run in batches, my first instinct was simply to upload the results table to production using something like "heroku db:push --tables data" - but the problem is that it is sslloowww and the app is without data for about 40mins at a time. the crunching batches need to be run about 4x per day - so it looks like this approach isn't really going to work. any suggestions how to speed this process up or any alternative schemes for getting the data less obtrusively up to the production server? thanks!
Sounds like you may have to rearchitect or what about running your rails app on EC2 and ditching Heroku? I think Heroku is great if your app is simple or you can make do with the plugins that they have. But when it gets complex I think it may be too complicated.
Heroku makes it clear that you cannot access their databases from outside. What you can do however is (if you want to stay on Heroku) is to use another database (like the RDS or roll your own) and have your application connect to it. Then upload data to that database directly.
What's the best way to synchronize few tables of mysql server with postgreSQL server?
Currently people are executing scripts, which takes much time, is there any fast solution available from which we can map the tables and columns to synchronize the db server.
You could expose the data from one and consume it with the other. Something like a web service, linked server, open data framework, ODBC driver, etc. Postgres has a nice ODBC driver that works pretty well.