Ubuntu 16.04.4 standalone fastdfs installation via docker
preamble
It's been a long time since I've written a tech podcast, which is something that shouldn't be done, there should be a sinking in when things are done.
I'll start with a little synopsis, the company's fastdfs suddenly hung up, did the operation is too large log file, so the log file to delete, in theory, this action should not affect the operation of the program is right.
Then tracker won't start anyhow. It reports the following error.
file: tracker_service.c, line: 2079, client ip: .52, group_name: group1, new ip address .217 != client ip address .52
I have both tracker and storage deployed on the same server, where the one starting with 47 is the public IP of the same server and the one starting with 172 is the intranet IP of this server.
Then the config files for tracker, storage and client, I've changed them all over, all to intranet, all to public, one to public and one to intranet. Anyway, it just doesn't work.
However, I was inspired to change the host file and assign a domain name to the ip so that all later configurations would use the domain name, which could potentially solve the problem.
Because the stored data are pulled from other places, just over a temporary transit, so it does not matter if the data inside is lost, so I thought, I simply re-install a fastdfs again.
But fastdfs can't be uninstalled directly with a single command, so I just deleted the various files associated with it.
But it's possible that I didn't delete it very cleanly, and when I installed the latest version of fastdfs, the compiledlibserverframeThe following error is reported.
Makefile:59: recipe for target 'fdfs_monitor' failed
After searching around, not many people mentioned this issue, then I tried the way to clone the code directly from git, going to git and downloading the zip and then unzipping it, and neither of them compiled.
Initially, it's a conflicting version of the dependency library, or something is missing.
Here's another digression, we're using themake intall
command, it should be customary to add the--prefix
parameter, the installation path of the configuration file, as follows:
make install --prefix=/opt/application
If not, the executable is placed by default after installation in the/usr/local/bin
The library files are placed by default in the/usr/local/lib
The configuration file is placed by default in the/usr/local/etc
The other resource files are placed in the/usr/local/share
。
Installation is a momentary pleasure, uninstallation is a crematorium.
Since the probable cause was a version conflict, and then I couldn't uninstall it cleanly now, I thought of docker, which is a separate environment opened up independent of the current main environment, and there are other services running on the server, and there's no way I could reset the server. I have to say docker is a great thing, what little genius invented it.
fastdfs image selection
fastdfs does not provide an official image, so you can only use the netizens to create their own.
/search?q=fastdfs
The most favorited mirror is a season one, however, I see that it is very old, like it is only version 1.2 and updated 9 years ago. So I didn't use this one, I saw several articles using delron's mirror, so I used this one too. Of course this one is pretty old too, updated 6 years ago.
But I'm in a hurry to solve the problem, and I don't have the heart to properly study and select, in short, pro-test it stand-alone good, easy to use, integrated nginx, you can directly through the browser to access the resources.
Pulling of mirrors
If you have this machine and haven't used docker before, it's still a cliché that you're likely to have a connection timeout and then a failed pull, so configure the image.
You can also install docker first if you haven't already:
apt install
Modify the image configuration file :
vim /etc/docker/
Add the addresses of the various mirrors (the ones that aren't indented are):
Here's a mirror image from the internet:
DaoCloud
AliCloud https://<your_code>. (AliCloud provides the mirror source: /cn-hangzhou/instances/mirrors After login you will get an exclusive address)
Docker image proxy
Baidu Cloud
Nanjing University
Chinese Academy of Sciences
"",
"." ,
"",
"." ,
""
Here's an example to make it easier to paste
{
"registry-mirrors": [
"",
"https://dc.",
"",
"",
"",
"",
"/",
".",
""
]
}
Reload the configuration and restart docker:
systemctl daemon-reload
systemctl restart docker
Run docker's tracker service:
# First create a folder, folder random definition, I here is for convenience, directly extended the definition of other people's podcasts (where -p is able to directly create a multi-level directory)
mkdir -p /mydata/fastdfs/tracker
cd /mydata/fastdfs/tracker
# Execute the docker command
docker run -d --name tracker --network=host -v /mydata/fastdfs/tracker:/var/fdfs delron/fastdfs tracker
# Note: The default port for the tracker service is 22122.
Run docker's storage service:
# Create the folder
mkdir -p /mydata/fastdfs/storage
cd /mydata/fastdfs/storage
# Execute the command
docker run -d --name storage --network=host -e TRACKER_SERVER=:22122 -v /mydata/fastdfs/storage:/var/fdfs -e GROUP_NAME=group1 delron/fastdfs storage
# Note: The ip in TRACKER_SERVER should be changed to the IP address of the service where your Tracker service resides.
# The default port for storage is 23000.
The storage service has nginx installed by default on port 8888.
service testing
1. Upload an image under /mydata/fastdfs/storage.
2. Go to the storage container and upload images
# Enter the storage container
docker exec -it storage bash
# Enter the container folder
cd /var/fdfs/
# Execute the upload command
/usr/bin/fdfs_upload_file /etc/fdfs/
Get the file path:group1/M00/00/00/
3. Browser access to the image:
.52:8888/group1/M00/00/00/
Being able to access it means that everything is fine with uploading and downloading.
Reference (not necessarily all)
/2019/04/13/linux-make-install-installation-and-uninstallation/
/weixin_50160384/article/details/139861337
/likecoke/p/
/hequanbao/p/
/zhouzaig/article/details/131412872
/docs/docker/