D
D
Danila Buyanov2011-03-06 10:28:00
Web development
Danila Buyanov, 2011-03-06 10:28:00

Portal development, implementation of your own API for working with the database?

Hello.
In the next few months, I have to develop a real estate portal. It will consist of several sites with a single database of objects, then the idea arose that if you take this database separately from the CMS databases and make a small API for requests to the database server both AJAX and just from the server via HTTP. Since I have no experience in creating such projects, I would like to discuss this with those who have it and find out about any bottlenecks and difficulties in advance, so to speak, at the design stage. And so the question, even questions.
As for the software, everything is standard. php 5.2 + mysql + apache2 + nginx + memcached on debian.
Hardware: Intel Cored 2 Duo 2660MHz 2GB DDR2 1TB on screw.

  1. Such a decision is justified (to take out the database), I will add something else that is possible later it will be necessary to organize access to the database of third-party organizations (more precisely, their sites)
  2. maybe you shouldn't use MySQL?
  3. Are there any difficulties in protecting such a database and connections to it?

Thanks to everyone who responds, I will be glad to any advice and reflection on this matter.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
sajgak, 2011-03-06
@sajgak

1. For organizing third-party access, this is a very convenient solution. + with good loads, you will not have any problems when moving the base to a separate piece of iron.
2. What structure is expected? (I have been working with MongoDB for a year now, almost the entire project, with proper organization of the database, can be transferred to it and get a performance gain). If you are interested - in a personal message.
3. If on 1 server - a separate user to change + 1 with rights to select for third-party users. And no problem. If you separate the base and logic: a firewall with access from 1 IP to 1 port. Handling third-party requests - also from this SP. (tobish without direct access to the database itself)

G
glebkk, 2011-03-06
@glebkk

Alternatively, instead of MySQL, you can use CouchDB, from the pros, for example, it already has a REST API for your API requests, only security (authentication, access levels) will have to be worked on.

Z
zizop, 2011-03-07
@zizop

1. Yes, if third-party access is planned. Then it will be easier.
2. Well, only if you are chasing fashion like "MySQL is no longer a cake." And so there is a wonderful thing - HandlerSocket. Use it, make a denormalized database right away, queries for PK, no jOINs and you will be happy)
3. Well, the only difficulty is that you need to write protection. HS accepts requests without access checking, so you only need to allow them from the local machine. And implement the entire protection system in php.
PS I would advise you to use REST architecture for database access in php.

V
Vyacheslav Plisko, 2011-03-08
@AmdY

yes, moving it to a separate service is very cool and MVC-shno. I have a link on this topic saved tutorials.jenkov.com/soa/soa.html dig on the site.
that is, you will make a full-fledged website-service. which authorizes, accepts the request, selects data from the store and spits it out.
it is convenient to drive data in json
regarding selections, there are two options - do named query=SelectCategory¶ms[id]=2 or make your own query language, such as developer.yahoo.com/yql/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question