企業私有云盤部署文件
阿新 • • 發佈:2019-01-02
使用seafile開源軟體實現
Seafile是新一代的企業雲端儲存產品。Seafile的叢集方案能滿足企業在高併發,大資料量,高可用性,高可靠性方面的要求。
Seafile叢集採用三層的架構設計,包括:
1. 負載均衡層:負載均衡器負責接收使用者的請求和資料,並分發給叢集中的Seafile伺服器;
2. Seafile伺服器叢集:由多個獨立的Seafile伺服器組成。負載均衡器自動檢測Seafile伺服器的可用性,如果一個Seafile伺服器宕機,負載均衡器會停止向它轉發資料,由此保證服務的高可用性。
3. 後端雲端儲存叢集:可支援 Amazon S3, OpenStack Swift以及Ceph這幾種基於物件的雲端儲存。這保證了儲存的可靠性和可擴充套件性。
先上圖看軟體實現的效果吧
閒話不多說上“菜”
系統環境
cat /etc/redhat-release
CentOS release 6.7 (Final)
uname -r
2.6.32-573.el6.x86_64
python 環境部署
yum或者使用*.tar.gz包進行安裝(不需要多解釋)
yum -y install zlib* openssl openssl-devel python-devel 安裝python2.7.10 #--enable-shared這個選項是centos6.X需要,如果系統是centos7.X不需要這個選項 tar xf Python-2.7.10.tgz cd Python-2.7.10 ./configure --enable-shared --prefix=/usr/local/python make && make install echo 'PATH=$PATH:/usr/local/python/bin' >>/etc/profile 檢查環境變數是否配置成功 tail -1 /etc/profile ln -s /usr/local/python/bin/python /usr/bin/python ln -s /usr/local/python/lib/libpython2.7.so.1.0 /usr/lib/ ln -s /usr/local/python/lib/libpython2.7.so.1.0 /usr/lib64/ source /etc/profile python -V Python 2.7.10 yum不相容python2.7+所以要修改一下yum的配置檔案 vim /usr/bin/yum #把標頭檔案#!/usr/bin/ypthon改成#!/usr/bin/python2.6.6 #再次使用yum就不會報找不到命令的錯誤了 #如果升級python 安裝完成2.7.10後使用以下方式。 ln -s /usr/local/python/bin/python /usr/bin/python
python -V
Python 2.7.10
得到以上資訊說明py升級成功!安裝setuptools
unzip setuptools-32.3.1.zip
cd setuptools-32.3.1
python setup.py build
python setup.py install
安裝pip
tar xf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py build
python setup.py install
安裝pillow
pip install pillow
安裝Mysql-python
是centos6.X需要手動安裝1.2.5,yum安裝的是1.2.3版本低,如果系統是centos7.X不需要手動安裝 unzip MySQL-python-1.2.5.zip cd MySQL-python-1.2.5 python setup.py build python setup.py install
以上Pyhton環境配置完成讓後安裝官方文件安裝即可
#在官網下載得到的軟體連結
yum -y install python-imaging python-ldap python-memcached python-urllib3
tar -zxf seafile-server_6.0.5_x86-64.tar.gz
cd seafile-server
cd seafile-server-6.0.5/
ll
./setup-seafile-mysql.sh
Checking python on this machine ...
Checking python module: setuptools ... Done.
Checking python module: python-imaging ... Done.
Checking python module: python-mysqldb ... Done.
-----------------------------------------------------------------
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at
https://github.com/haiwen/seafile/wiki
Press ENTER to continue
-----------------------------------------------------------------
What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] wlkj #根據需求起名字
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 172.16.10.201 #伺服器IP地址
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/server/tools/seafile-data" ] /data/
Which port do you want to use for the seafile fileserver?
[ default "8082" ] #資料傳輸預設埠
-------------------------------------------------------
Please choose a way to initialize seafile databases:
-------------------------------------------------------
[1] Create new ccnet/seafile/seahub databases #創造新的ccnet/seafile/seahub資料庫
[2] Use existing ccnet/seafile/seahub databases #利用現有ccnet/seafile/seahub資料庫
[ 1 or 2 ] 2
What is the host of mysql server?
[ default "localhost" ] 172.16.10.101 #資料庫IP地址(資料庫跟seafile伺服器單獨存放,如果在本地使用localhost連線)
From which hosts could the mysql account be used?
[ default "%" ]
What is the port of mysql server?
[ default "3306" ] #資料庫預設埠
Which mysql user to use for seafile?
[ mysql user for seafile ] seafile #資料庫使用者名稱
What is the password for mysql user "seafile"?
[ password for seafile ] #資料庫密碼
verifying password of user seafile ... done
Enter the existing database name for ccnet:
[ ccnet database ] seafile #資料庫名
verifying user "seafile" access to database seafile ... done
Enter the existing database name for seafile:
[ seafile database ]
[ seahub database ] seafile
verifying user "seafile" access to database seafile ... done
---------------------------------
This is your configuration
---------------------------------
server name: wlkj
server ip/domain: 172.16.10.201
seafile data dir: /data/
fileserver port: 8082
database: use existing
ccnet database: seafile
seafile database: seafile
seahub database: seafile
database user: seafile
---------------------------------
Press ENTER to continue, or Ctrl-C to abort
---------------------------------
---------------------------------
Press ENTER to continue, or Ctrl-C to abort
---------------------------------
Generating ccnet configuration ...
done
Successly create configuration dir /server/tools/ccnet.
Generating seafile configuration ...
Done.
done
Generating seahub configuration ...
----------------------------------------
Now creating seahub database tables ...
----------------------------------------
creating seafile-server-latest symbolic link ... done
-----------------------------------------------------------------
Your seafile server configuration has been finished successfully.
-----------------------------------------------------------------
run seafile server: ./seafile.sh { start | stop | restart } #啟動方式
run seahub server: ./seahub.sh { start <port> | stop | restart <port> } #關閉方式
-----------------------------------------------------------------
If you are behind a firewall, remember to allow input/output of these tcp ports:
-----------------------------------------------------------------
port of seafile fileserver: 8082
port of seahub: 8000
When problems occur, Refer to
https://github.com/haiwen/seafile/wiki
for information.
==========================================================================================================================================
#進入seafile解壓目錄啟動seafile服務
cd /server/tools/seafile-server-6.0.5/
./seafile.sh start
#預設埠號是8000,可以手動指定埠號
./seahub.sh start
#配置nginx(我是用的nginx做web服務,根據個人喜好)編輯nginx配置檔案(nginx擴充套件配置檔案)複製以下內容:
server {
listen 80;
server_name cloud.fairvo.com;
proxy_set_headerX-Forwarded-For $remote_addr;
location / {
fastcgi_pass cloud.fairvo.com:8000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REMOTE_ADDR $remote_addr;
access_log /app/logs/nginx/seahub.access.log;
error_log /app/logs/nginx/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1break;
proxy_passhttp://cloud.fairvo.com:8082;
client_max_body_size 0;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
}
location /media {
root/server/tools/seafile-server-latest/seahub;
}
}
#進入網站後臺 系統設定修改
SERVICE_URL =http://自己的地址
FILE_SERVER_ROOT = 'http://自己的地址/seafhttp'
#檢視埠顯示如下內容
netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 14768/python2.7
tcp 0 0 0.0.0.0:82 0.0.0.0:* LISTEN 14654/nginx
tcp 0 0 0.0.0.0:8082 0.0.0.0:* LISTEN 14523/seaf-server
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1985/sshd
tcp 0 0 :::22 :::* LISTEN 1985/sshd