Answer the question
In order to leave comments, you need to log in
How to make a simple horizontal sharding for the file system?
Data is stored in the file system in folders of several levels. The whole id
is translated into the "address" of the folder, for example, /data/AF/BF/C4/06/
where there are several binary files with data sets for this id
.
Hosted by an inexpensive provider, where it is more profitable to take another box than to increase the disk in an existing one. As it grew, I had to connect several new servers and transfer some of the trees to them. The top level folders are now split like this:
00–3F – основной сервер
40–7F – 1-й дополнительный
80–FF – 2-й дополнительный
/data/
there are now symlinks to NFS mounts. Everything works ok. 00–FF
in the working data folder. /data/AF/C7/C7/56/
(from php, mkdir()
with $recursive = true
). /data/AF/C7
already existed, but instead of a new folder nested in it C7
, a symlink to the parent folder was created C7
, and the script crashed with a critical error about the impossibility of creating a directory. I still don't understand why this occurs. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question