MogileFS Advanced Applications (3)

Source: Internet
Author: User
Tags install perl

MogileFS Advanced Applications

Architecture diagram:

Experiment Description:

1 mysql+3 is mogstored and tracker node + 1 Nginx Implementation of the reverse generation

To use fewer hosts, we use 2 hosts

Nginx + mogstored + Tracker

MySQL + mogstored + Tracker

The first step here is to quickly deploy mogstored + Tracker Environment (detailed deployment please refer to the previous blog)

1. First set up the MySQL server

MySQL > Grant all on mogdb.* to ' moguser ' @ ' 10.1.%.% ' identified by ' Mogpass ', MySQL > Grant all on *. * to ' root ' @ ' 10. 1.%.% ' identified by ' root '; -this permission is too large for the build environment to adjust MySQL > flush privileges as needed;

2.tracker + mogstored Configuration

Tracker configuration:

# mogdbsetup--dbhost= >--dbrootuser=root--dbrootpass=root--dbuser= Moguser--dbpass=mogpass# vim/etc/mogilefs/mogilefsd.conf db_dsn = Dbi:mysql:mogdb:host= = Moguserdb_pass = Mogpasslisten = Service MOGILEFSD start# ss-tln | grep "7001"

3. Configure this server at the same time as the mogstored side

# mkdir-pv/var/mogdata/dev1# chown-r mogilefs.mogilefs/var/mogdata/# yum-y install perl-io-aio# service mogstored St art# NETSTAT-TLNP | grep "mogstored" # mogadm--trackers= host add creation fails, May be due to the resolution of the/etc/hosts file and the true hostname inconsistency, modify the/etc/hosts file can be # scp/etc/mogilefs/* another server, Two servers using the same configuration file

4. Configure another server as a tracker+mogstored

At this point, the server as tracker, no need to initialize the database, the first one has been initialized # MKDIR/VAR/MOGDATA/DEV3-PV--The directory created here needs to be consistent with the name of the created device # Chown-r mogilefs.mogilefs/var/mogdata/# chown-r mogilefs.mogilefs/var/run/mogilefsd/# service MOGILEFSD start# Service mogstored start# mogadm--trackers= host add

5. Add each other's host

# mogadm--trackers= host add mogadm--trackers= host add mogadm--trackers= Host list10.1.249.125 [1]: Alive ip: [2]: Alive ip: # Mogadm--tra CKERS= host list10.1.249.125 [1]: Alive ip: [2]: Alive ip:10.1 .252.53:7500

6. Add the device, in the same tracker operation can

# mogadm --trackers= device add 1# mogadm  --trackers= device add 3  -->  Consistent with the directories created above # mogadm --trackers= device list10.1.249.125 [1]:  alive                     used (g)     free (g)    total (g)   weight (%)     dev1:   alive      6.484      84.630     91.114        10010.1.252.53  [2]: alive                     used (g)     free (g)    total (g)    weight (%)    DEV3:&Nbsp;  alive      6.176     84.938      91.114        100

7. Create a domain

# mogadm --trackers= domain add images# mogadm --trackers= domain add files# mogadm --trackers= domain  list domain                class                 Mindevcount   replpolicy   hashtype-------------------- ------------------- - ------------- ------------ ------- files                 default                    2         Multiplehosts ()  NONE    images                default                    2        multiplehosts ()  NONE

8. Create a class

# mogadm --trackers= class add images class0 --mindevcount= 2# mogadm --trackers= class add images class1 --mindevcount =2# mogadm --trackers= class list domain                class                 mindevcount   replpolicy    hashtype-------------------- -------------------- ------------- ------------ - ------ files                 default                    2        multiplehosts ()  NONE     images               class0                     2         multiplehosts ()  NONE    images                class1                     2         multiplehosts ()  NONE    images                default                    2         multiplehosts ()  none

9.nginx Configuration

Compile and install Nginx to support the MogileFS module # tar xf nginx_mogilefs_module-1.0.4.tar.gz# tar xf  nginx-1.8.0.tar.gz# cd nginx-1.8.0# ./configure   --prefix=/usr    --sbin-path=/usr/sbin/nginx   --conf-path=/etc/nginx/nginx.conf   -- error-log-path=/var/log/nginx/error.log   --http-log-path=/var/log/nginx/access.log    --pid-path=/var/run/nginx/    --lock-path=/var/lock/nginx.lock    --user=nginx   --group=nginx   --with-http_ssl_module   -- With-http_flv_module   --with-http_stub_status_module   --with-http_gzip_static_ module   --http-client-body-temp-path=/var/tmp/nginx/client/   -- http-proxy-temp-path=/var/tmp/nginx/proxy/   --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/    --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi   --http-scgi-temp-path=/var/tmp/nginx/scgi   --with-pcre    --with-debug   --add-module= (Path to nginx_mogilefs_module-1.0.4 module) # make  && make install

Nginx Reverse mogilefs configuration file upstream mogilefscluster{server; Server;}    location/images/{Mogilefs_tracker mogilefscluster;    Mogilefs_domain images;        Mogilefs_pass {proxy_pass $mogilefs _path;        Proxy_hide_header Content-type;        Proxy_buffering off; }}

10. Back-end node upload a picture for testing (back-end two servers randomly select one can)

# mogupload--trackers= ' 1.jpg '--file= '/tmp/1.jpg ' # mogupload--trackers= ' 2.jpg '--file= '/tmp/2.jpg ' # Moglistkeys--trackers= =images1.jpg2.jpg

11. View the actual access path

# mogfileinfo-trackers= "1.jpg"- 0000000018.fid- can see there are two, because we have two mogstored, All mogilefs automatically helped us with redundancy.

650) this.width=650; "Src=" Http:// -wmp_4-s_3746670928.png "title=" 3.png "alt=" Wkiom1hakoehafkyaae8jv9brhk068.png-wh_50 "/>

12. Access path after the Nginx is reversed


650) this.width=650; "Src=" Http:// -wmp_4-s_2985159923.png "title=" 1.png "alt=" Wkiol1haktxxfnjpaaerohnpqqw956.png-wh_50 "/>

650) this.width=650; "Src=" Http:// -wmp_4-s_3831260863.png "title=" 2.png "alt=" Wkiom1hakvbi8m09aahhfzxuini599.png-wh_50 "/>

This article is from the "Homecoming" blog, make sure to keep this source

MogileFS Advanced Applications (3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.