Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mogilefs distributed storage

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Install the environment package first

Note that the following package is the center7 version

.yum install perl-Net-Netmask perl-IO-String perl-Sys-Syslog perl-IO-AIO

Download the software package. The following is attached.

Https://pan.baidu.com/s/1NWQwvOMw6gvFCH_Po5v9Nw

MogileFS-Server-2.46-2.el7.centos.noarch.rpm # Core Services MogileFS-Server-mogilefsd-2.46-2.el7.centos.noarch.rpm # tracker Node MogileFS-Server-mogstored-2.46-2.el7.centos.noarch.rpm # storage Node MogileFS-Utils-2.19-1.el7.centos.noarch.rpm # Management tools for mogilefs For example, mogadm perl-Danga-Socket-1.61-1.el6.rf.noarch.rpm # dependency package perl-MogileFS-Client-1.14-1.el7.centos.noarch.rpm perl-Perlbal-1.78-1.el6.noarch.rpmnginx_mogilefs_module-1.0.4.tar.gz # ngingx connection mogilefs module block nginx-1.16.1.tar.gz # nginx compilation package

Cd directly to the folder to execute yum localinstall. / *-y # each node is installed

2 install mysql and create the database (192.168.1.31 node)

Install the mysql in 192.168.1.31 and create the library mogilefs. After creating the user mogilefs@192.168.%.% and giving the mogilefs library full control, it is best to log in to see if there is a mogilefs library under the 192.168.1.13 test with mysql-h.

3. Initialize the database

Mogdbsetup-dbuser mogilefs-dbpass 123456-dbhost=192.168.1.31

# mogdbsetup available with other parameters-- help View help

4. Configure the mogilefs controller and start (192.168.1.13 node)

Vim / etc/mogilefs/mogilefsd.conf # modify the configuration file of tracker, controller

Db_dsn = DBI:mysql:mogilefs:host=192.168.1.31 # database address db_user = mogilefs # database account db_pass = 123456 # database password listen = 192.168.1.13 db_user 7001 # mogilefs listening ip and port

Service mogilefsd start # start the tracker service

Netstat-nltp to see if port 7001 is listening

5. Configure storage (Storage Node) (192.168.1.13192.168.1.14192.168.1.21)

Maxconns = 10000 # maximum concurrent connection

Httplisten = 0.0.0.0 7500 # listening port

Mgmtlisten = 0.0.0.0 7501 # Port on which the management command listens

Docroot = / date/ # storage directory, it is recommended to use a separate storage disk

Mkdir / data/ # create folder

Chown-R mogilefs.mogilefs / data/ # change ownership

Service mogstored start # start the storage service

Netstat-nltp to see if port 7500 7501 is listening

6. Add a storage node on the control node (192.168.1.13)

Mogadm-trackers=192.168.1.13:7001 host add 192.168.1.14-ip=192.168.1.14-port=7500-status=alive

#-trackers=192.168.1.13:7001 indicates here that the control node has multiple uses, separated, and each node needs to be added

Mogadm-- trackers=192.168.1.13:7001 check # View added nodes

7. Create a storage device (192.168.1.13192.168.1.14192.168.1.21)

Mkdir / data/dev13 # create three directories on three hosts: dev13, dev14, and dev21 as storage devices. The following number is that id must be unique. It is recommended to use the last bit of ip.

Chown-R mogilefs:mogilefs / data/ # the newly created directory is owned by root and needs to be changed back

8. Add storage devices to the mogilefs control node (192.168.1.13)

Mogadm-- trackers=192.168.1.13:7001 device add 192.168.1.13 13 # # do it each

9. Create domains (namespaces) and classes (192.168.1.13)

Mogadm-- trackers=192.168.1.13:7001 domain add yangzai # # create a namespace for yangzai

Mogadm-trackers=192.168.1.13:7001 class add yangzai jpg-mindevcount=2

# create a jpg class in the Yangzai domain and specify that the minimum number of copies is 2. The default is 2.

Mogadm-trackers=192.168.1.13:7001 class add yangzai txt-mindevcount=3

Mogadm-- trackers=192.168.1.13:7001 domain list # # look

10. Upload image data and view

Mogupload-tracker=192.168.1.13:7001-domain=yangzai-class=jpg-key=111-file=/root/111.png

# upload image to specify domain, class, id, path

Mogfileinfo-tracker=192.168.1.13:7001-domain=yangzai-key=111

# View the file, specify the domain, and id

# enter it in the browser and click url in the red box to see the picture

11. Compile and install nginx instead of the past

Yum groupinstall "Development Tools"Server Platform Deveopment"-y

Yum install openssl-devel pcre-devel-y

# install the compilation environment

Execute the following command from cd to the nginx compilation directory

. / configure\

-- prefix=/usr/local/nginx\

-- 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/nginx.pid\

-- 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\

-- third-party module added by add-module=/root/nginx_mogilefs_module-1.0.4 # to access directly using key as uri

Error vim / vim objs/Makefile may be reported in the middle

Just delete the-Werror field.

Make & & make install # installation

Mkdir-pv / var/tmp/nginx/client/ # # create a folder, otherwise nginx startup will report an error

Vim / etc/nginx/nginx.conf

Upstream images {# create access group server 192.168.1.13 server 7001; server 192.168.1.14 server 7001; server 192.168.1.21 server 7001;} server {listen 80; server_name localhost; location / jpg/ {# # files that are transferred to the yangzai namespace when matching to / jpg/, and access mogilefs_tracker images with key as id Mogilefs_domain yangzai; mogilefs_methods GET; mogilefs_noverify on; mogilefs_pass {proxy_pass $mogilefs_path; proxy_hide_header Content-Type; proxy_buffering off;}} location / txt {mogilefs_tracker images; mogilefs_domain yangzai Mogilefs_methods GET; mogilefs_noverify on; mogilefs_pass {proxy_pass $mogilefs_path; proxy_hide_header Content-Type; proxy_buffering off;}} 12. Use browsing to access

13.BUG solution

By default, mogilefs will have at least one copy, while center7 will not replicate

The reason is that there is a plug-in with BUG, which needs to be downgraded.

Yum-y install make gcc unzip perl-DBD-MySQL perl perl-CPAN perl-YAML perl-Time-HiRes # # compilation environment

Wget http://pkgs.fedoraproject.org/repo/pkgs/perl-Sys-Syscall/Sys-Syscall-0.23.tar.gz/be6dc2d791684a6f8abb3dd39ff2d1de/Sys-Syscall-0.23.tar.gz

All three nodes need to be compiled and installed, and restart to see that there are already two files.

14.mogilefs common command service mogilefsd start (stop) # start and close tracker service control side service mogstored start (stop) # start and shut down storage service storage side mogadm-- trackers=192.168.1.13:7001 check # View added node mogadm-- trackers=192.168.1.13:7001 domain list # View namespace mogfileinfo-- tracker=192.168.1.13:7001-- domain=yangzai-- key=111 # View file

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report