tar xf mariadb-10.0.20-linux-x86_64.tar.gz -C /usr/local/ cd /usr/local/ ln -sv mariadb-10.0.20-linux-x86_64 mysql useradd -r mysql mkdir -pv /mydata/data chown -R mysql.mysql /mydata/data/ cd mysql/ chown -R root.mysql . scripts/mysql_install_db --user=mysql --datadir=/mydata/data/ cp support-files/my-large.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on
2.安裝YAML:
wget http://search.cpan.org/CPAN/authors/id/I/IN/INGY/YAML-1.15.tar.gz tar xf YAML-1.15.tar.gz cd YAML-1.15 perl Makefile.PL make && make install
3.使用cpan在線安裝MogileFS和相關模塊: cpan -----------------------------------> install MogileFS::Server //後面有讓輸入yes的地方則輸入yes並回車即可 4.創建授權用戶:
/usr/local/mysql/bin/mysql ------------------------------------------> USE mysql; UPDATE user SET Password=PASSWORD(123456) WHERE User='root'; GRANT ALL ON mogilefs.* TO 'moguser'@'192.168.19.%' IDENTIFIED BY '123456'; GRANT ALL ON *.* TO 'root'@'192.168.19.%' IDENTIFIED BY '123456'; FLUSH PRIVILEGES;
5.初始化數據庫: mogdbsetup --dbhost=192.168.19.66 --dbrootuser=root --dbrootpass=123456 --dbuser=moguser --dbpass=123456 --yes 如果出現如下報錯,則重新運行一次該命令,一般數據就可正常導入了: 6.創建Tracker配置文件:
mkdir /etc/mogilefs vim /etc/mogilefs/mogilefsd.conf ---------------------------------------------------------> db_dsn = DBI:mysql:mogilefs:host=192.168.19.66 db_user = moguser db_pass = 123456 conf_port = 7001 listener_jobs = 5 node_timeout = 5 rebalance_ignore_missing = 1
7.創建mogile用戶並啟動測試,查看端口,看到7001已經開始監聽了。另外可以使用“pkill mogilefsd”來停止mogilefsd服務。 useradd mogile su mogile -c "mogilefsd -c /etc/mogilefs/mogilefsd.conf --deamon" 二、在19.74和19.76上安裝MogileFS 1.安裝YAML: wget http://search.cpan.org/CPAN/authors/id/I/IN/INGY/YAML-1.15.tar.gz tar xf YAML-1.15.tar.gz cd YAML-1.15 perl Makefile.PL make && make install 2.使用cpan在線安裝MogileFS: cpan --------------------------------> install MogileFS::Server 3.創建Storage配置文件:
mkdir /data/mogdata -pv useradd mogile chown -R mogile.mogile /data/mogdata mkdir /etc/mogilefs vim /etc/mogilefs/mogstored.conf -----------------------------------------------------> httplisten=192.168.19.74:7500 //在19.76上把地址改了即可 mgmtlisten=192.168.19.74:7501 docroot=/data/mogdata
4.啟動MogileFS Storage節點,查看端口,看到7500和7501開始監聽了。另外可以使用“pkill mogstored”來停止mogstored服務。 mogstored --daemon 三、管理配置MogileFS 1.三台主機安裝MogileFS-Utils: cpan --------------------------------> install MogileFS::Utils 2.在Tracker上添加Storeage節點: mogadm --trackers=192.168.19.66:7001 host add test --ip=192.168.19.74 --port=7500 --status=alive mogadm --trackers=192.168.19.66:7001 host add tsst --ip=192.168.19.76 --port=7500 --status=alive 3.創建存儲目錄: 在19.74上: mkdir /data/mogdata/dev1 在19.76上: mkdir /data/mogdata/dev2 4.在Tracker上添加存儲設備: mogadm --trackers=192.168.19.66:7001 device add test 1 mogadm --trackers=192.168.19.66:7001 device add tsst 2 mogadm --trackers=192.168.19.66:7001 device list mogadm --trackers=192.168.19.66:7001 check mogadm domain add jason 5.上傳文件測試: mogupload --trackers=192.168.19.66:7001 --domain=jason --key='/fstab.html' --file='/etc/fstab' mogfileinfo --trackers=192.168.19.66:7001 --domain=jason --key='/fstab.html' 用浏覽器打開紅框內的連接,即可看到文件: 咱們上傳個圖片試試: mogupload --trackers=192.168.19.66:7001 --domain=jason --key='/centos.png' --file='/usr/share/backgrounds/default.png' mogfileinfo --trackers=192.168.19.66:7001 --domain=jason --key='/centos.png'