share data between server applications |
I have 3 server that same server application is running on each of them. each installation of server app has its own configurations, data and settings. other client users or client applications can connect to this servers and communicate with them.
but now i need to share some data between this server applications. for example server A needs to access to information of server B's customers. or main admin of system want to see some information of server C. other scenario may be back up/sync. each server with 4th server with special application. this servers are in different places. this application are created by PHP and servers are ubuntu servers, each server has its own static IP. how i can do this? any one done same thing before and how? witch is the more secure way?
ressan.ir
CI is nice
What type of data needs to be shared? Data that is stored in a database or regular files?
You could open SQL port 3306 on server B so server A can access it directly (better to use ssh tunnel for encrypted connection). You could sync all the databases (master-slave setup). If data on server A gets changed, that change is pushed to server B etc. For files you could use rsync (over ssh) to keep files synchronised between two or more locations You could write a php api on server B wich server A calls when it's need some data etc.
You could do it in different ways.
1. You could create some API endpoints so the apps could communicate with each other; 2. You could whitelist each servers IP address and use multiple database connections to grab (and maybe cache, if possible) data to be used as needed; Personally, independently of the type of information stored on each server, I'd go with option 1 and standardize the communications via an API.
Best regards,
José Postiga Senior Backend Developer
(08-17-2017, 12:36 AM)Diederik Wrote: What type of data needs to be shared? Data that is stored in a database or regular files? my data are stored in database. connecting from server A to database on the server B, hum i think it is not good idea. but can you suggest me page or tutorial about syncing data (master-slave)?
ressan.ir
CI is nice
(08-17-2017, 02:23 AM)josepostiga Wrote: You could do it in different ways. EXACTLY! i want to create some api for applications so they could communicate to each other, but you think is it enough to limit IP whitelist and SSL for security? how hide apis from anyone except this server application (and only my applications on the servers)? i think i should create second application on the completely different server (server X), and if server A needs some data from server B, server A send request to server X and server X get needed data from server B and passes them tho server A. has this way any additional benefits? and how i should use token or key or any thing else so servers recognize/validate requests?
ressan.ir
CI is nice
(08-17-2017, 04:37 AM)nasser.man Wrote:(08-17-2017, 02:23 AM)josepostiga Wrote: You could do it in different ways. Well, I'd go with a secret key sent with every request and if the supplied key is validated successfully on your server X, then the request is handled... With that, there's no need to "hide" your API as only the requests with the correct API KEY should be processed. There's lots of examples throughout the Internet. Anything more specific, ask for help here.
Best regards,
José Postiga Senior Backend Developer
The requests should be done server side, of course... Just study other's API implementations and study a little bit more before doing any actual work.
Best regards,
José Postiga Senior Backend Developer
(08-17-2017, 08:46 AM)josepostiga Wrote: The requests should be done server side, of course... Just study other's API implementations and study a little bit more before doing any actual work. thank you very much, do you have link or tutorials for creating secure api using codeigniter/php?
ressan.ir
CI is nice |
Welcome Guest, Not a member yet? Register Sign In |