Simple installation configuration and use of MogileFS
Installation of this software requires the use of CPAN or source code to compile or make RPM packages
At this point we use the already produced RPM package demo
Environment Introduction
Tracker + MySQL 10.1.249.125
Storage 10.1.252.52
The required RPM package
mogilefs-server-2.46-2.el6.noarch.rpm mogilefs-server-mogilefsd-2.46-2.el6.noarch.rpm MogileFS-Server-mogstore d-2.46-2.el6.noarch.rpm mogilefs-utils-2.19-1.el6.noarch.rpm Perl-net-netmask-1.9015-8.el6.noarch.rpmperl-per Lbal-1.78-1.el6.noarch.rpmperl-mogilefs-client-1.14-1.el6.noarch.rpmperl-io-stringy-2.110-1.2.el6.rfx.noarch.rpmperl-dang a-socket-1.61-1.el6.rf.noarch.rpm
Install RPM packages (all nodes need to be installed)
# yum-y Install *--there is a dependency and all of the above packages need to be installed
First, configure the tracker node
1. Database settings, set on the tracker node
# mogdbsetup--dbhost=localhost--dbport=3306--dbname=mogilefs >--dbrootuser=root--dbrootpass=root--dbuser= Moguser--dbpass=mogpass--the database and its users may not exist in advance and will be automatically set
2. At this point, we can verify in the database
mysql> show databases; --MogileFS library still exists +--------------------+| Database |+--------------------+| Information_schema | | Jchome | | MogileFS | | MySQL | | Shopxx | | Test | | TestDB |+--------------------+mysql> use mogilefsmysql> show tables; --Many tables are generated
3. Modify the configuration file
# vim/etc/mogilefs/mogilefsd.conf--and database configuration to be consistent db_dsn = Dbi:mysql:mogilefs:host=127.0.0.1db_user = Moguserdb_pass = Mogpasslisten = 10.1.249.125:7001
4. Turn on the service
# service MOGILEFSD Start-to-open MOGILEFSD process # Ss-tln | grep "7001"-check to see if 7001 ports are listening
Second, configure the mogstored node
1. Install the same RPM package
2. View the configuration file--Use default, no need to modify
3. Create the corresponding directory, as defined in the configuration file
# mkdir-pv/var/mogdata# Chown-r mogilefs.mogilefs/var/mogdata/
4. Start the service process
# service mogstored start# NETSTAT-TLNP | grep "Mogstored"
Simple test (The following command is performed on the tracker node)
1. Detecting tracker Nodes
# Mogadm--tracker=10.1.249.125:7001 checkchecking trackers ... 10.1.249.125:7001 ... OK-to-tracker node configuration succeeded Checking hosts ...-At this time no host was added to the tracker node in the no Devices found on tracker (s).
2. List the hosts
# mogadm--TRACKER=10.1.249.125:7001 Host List--and this time is empty because we haven't made any configuration yet
3. Add mogstored node, accept tracker Management
# mogadm--tracker=10.1.249.125:7001 host add 10.1.252.53--ip=10.1.252.53--status=alive# mogadm--tracker= 10.1.249.125:7001 host list10.1.252.53 [1]: Alive ip:10.1.252.53:7500-Add success
4. Add a Device
# mogadm --tracker=10.1.249.125:7001 device list10.1.252.53 [1]: alive used (g) free (g) total (g) weight (%) --> There are no settings at this time # mogadm --tracker=10.1.249.125:7001 device add 10.1.252.53 1 --> Add Device # mogadm --tracker=10.1.249.125:7001 device list10.1.252.53 [1]: alive used (g) free (g) total (g) weight (%) dev1: alive 6.182 84.933 91.114 100 --> Add success
At this point we look at the data directory of the Mogstored node and the DEV1 directory will appear
# ls/var/mogdata/dev1/-the command executes 0 test-write usage on the mogstored node
5. Add a domain
# mogadm--tracker=10.1.249.125:7001 Domain add img (domain name) # mogadm--tracker=10.1.249.125:7001 domain list domain Class Mindevcount Replpolicy hashtype------------------------------------------------------------ ------------img Default 2 multiplehosts () NONE
6.
A) Upload file # mogupload--trackers=10.1.249.125:7001--domain=img--key= "fstab"--file= '/etc/fstab ' B) view uploaded file # Moglistkeys- -trackers=10.1.249.125:7001--domain=imgc) View Access path # mogfileinfo--trackers=10.1.249.125:7001--domain=img--key= ' Fstab '-Http://10.1.252.53:7500/dev1/0/000/000/0000000003.fid and since we have only one mogstored node here, all access paths are only one, If we have 2 mogstored nodes and two access paths, MogileFS will automatically replicate the files (redundancy)
7.
A) First view file List # Moglistkeys--trackers=10.1.249.125:7001--domain=imgfstabissueb) Download File # Mogfetch--trackers= 10.1.249.125:7001--domain= ' img '--key= ' issue ' (need to correspond to above)--file= ' Issue.bak ' (downloaded file name, under current directory)
8.
A) First view file List # Moglistkeys--trackers=10.1.249.125:7001--domain=imgfstabissueb) Delete File # Mogdelete--trackers= 10.1.249.125:7001--domain=img--key=fstabc) view file list again Moglistkeys--trackers=10.1.249.125:7001--domain=imgissue-- > Fstab file has been successfully deleted
This article is from the "Homecoming" blog, make sure to keep this source http://sixijie123.blog.51cto.com/11880770/1878640
MogileFS installation configuration and use (2)