Skip to content

Commit

Permalink
fix: curve-ansible
Browse files Browse the repository at this point in the history
Change-Id: I6e50a6efddf50408e97866183bf999d467ae4d45
  • Loading branch information
charisu authored and wu-hanqing committed Jul 15, 2020
1 parent 69b2a5d commit fb72406
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 1,071 deletions.
13 changes: 0 additions & 13 deletions conf/mds.conf
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,6 @@ mds.heartbeat.clean_follower_afterMs=1200000
# 记录数量:524288+2621440 ~= 300w左右
mds.cache.count=100000

#
# mysql Database config
#
# 数据库使用的database名称
mds.DbName=curve_mds
# 数据库用户名
mds.DbUser=root
# 数据库地址
mds.DbUrl=localhost
# 数据库登录密码
mds.DbPassword=qwer
mds.DbPoolSize=128

#
# mds file record settings
#
Expand Down
8 changes: 0 additions & 8 deletions conf/snapshot_clone_server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ log.dir=./
#
s3.config_path=./conf/s3.conf
#
#metastore options
#
metastore.db_name=curve_snapshot
metastore.db_user=root
metastore.db_passwd=qwer
metastore.db_address=localhost
metastore.db_poolsize=128
#
#server options
#
# for snapshot
Expand Down
12 changes: 0 additions & 12 deletions conf/snapshot_tools.conf

This file was deleted.

2 changes: 2 additions & 0 deletions curve-ansible/deploy_snapshotcloneserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
roles:
- { role: install_package, package_name: snapshotcloneserver, package_version: "{{ snapshot_package_version }}",
tags: ["install_package", "install_snap_package"] }
- { role: install_package, package_name: aws-sdk, package_version: "{{ aws_package_version }}",
tags: ["install_package", "install_aws_sdk_package"] }
- { role: generate_config, template_name: snapshot_clone_server.conf, conf_path: "{{ snapshot_config_path }}",
tags: ["generate_config", "generate_snap_conf"] }
- { role: generate_config, template_name: client.conf, conf_path: "{{ snap_client_config_path }}",
Expand Down
2 changes: 1 addition & 1 deletion curve-ansible/group_vars/mds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ cluster_map:
physicalpool: pool1
type: 0
replicasnum: 3
copysetnum: 2000
copysetnum: 100
zonenum: 3
scatterwidth: 0
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
global.ip={{ ansible_ssh_host }}
global.port={{ chunkserver_base_port }}
global.subnet={{ chunkserver_subnet }}
global.enable_external_server={{ chunkserver_enable_external_server }}
global.external_ip={{ ansible_ssh_host }}
global.external_subnet={{ chunkserver_external_subnet }}
# chunk大小,一般16MB
global.chunk_size={{ chunk_size }}
# chunk 元数据页大小,一般4KB
Expand Down
13 changes: 0 additions & 13 deletions curve-ansible/roles/generate_config/templates/mds.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,6 @@ mds.heartbeat.clean_follower_afterMs={{ mds_heartbeat_clean_follower_after_ms }}
# 记录数量:524288+2621440 ~= 300w左右
mds.cache.count={{ mds_cache_count }}

#
# mysql Database config
#
# 数据库使用的database名称
mds.DbName={{ mds_db_name }}
# 数据库用户名
mds.DbUser={{ mds_db_user }}
# 数据库地址
mds.DbUrl={{ mds_db_url }}
# 数据库登录密码
mds.DbPassword={{ mds_db_password }}
mds.DbPoolSize={{ mds_db_pool_size }}

#
# mds file record settings
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ log.dir={{ snap_log_dir }}
#
s3.config_path={{ snap_s3_config_path }}
#
#metastore options
#
metastore.db_name={{ snap_db_name }}
metastore.db_user={{ snap_db_user }}
metastore.db_passwd={{ snap_db_password }}
metastore.db_address={{ snap_db_url }}
metastore.db_poolsize={{ snap_db_pool_size }}
#
#server options
#
# for snapshot
Expand Down

This file was deleted.

91 changes: 31 additions & 60 deletions curve-ansible/roles/install_package/templates/chunkserver_ctl.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,6 @@ function help() {
echo " -chunkfilepool_metapath==/data/chunkserver{id}/chunkfilepool.meta"
echo "OPSTIONS:"
echo " [-c|--confPath path] chunkserver conf path need for start command, default:/etc/curve/chunkserver.conf"
echo " [-nc|--noConfirm] if specified, deploy no need to confirm"
}

# 从subnet获取ip
function get_ip_from_subnet() {
subnet=$1
prefix=`echo $subnet|awk -F/ '{print $1}'|awk -F. '{printf "%d", ($1*(2^24))+($2*(2^16))+($3*(2^8))+$4}'`
mod=`echo $subnet|awk -F/ '{print $2}'`
mask=$((2**32-2**(32-$mod)))
# 对prefix再取一次模,为了支持10.182.26.50/22这种格式
prefix=$(($prefix&$mask))
ip=
for i in `/sbin/ifconfig -a|grep inet|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
do
# 把ip转换成整数
ip_int=`echo $i|awk -F. '{printf "%d\n", ($1*(2^24))+($2*(2^16))+($3*(2^8))+$4}'`
if [ $(($ip_int&$mask)) -eq $prefix ]
then
ip=$i
break
fi
done
if [ -z "$ip" ]
then
echo "no ip matched!\n"
exit 1
fi
}

# 启动chunkserver
Expand All @@ -82,27 +55,34 @@ function start() {
return 1
fi
# parse subnet mask from config
internal_subnet=`cat $confPath|grep global.subnet|awk -F"=" '{print $2}'`
subnet=`cat $confPath|grep global.subnet|awk -F"=" '{print $2}'`
port=`cat $confPath|grep global.port|awk -F"=" '{print $2}'`
get_ip_from_subnet $internal_subnet
internal_ip=$ip
echo "ip: $internal_ip"
prefix=`echo $subnet|awk -F/ '{print $1}'|awk -F. '{printf "%d", ($1*(2^24))+($2*(2^16))+($3*(2^8))+$4}'`
mod=`echo $subnet|awk -F/ '{print $2}'`
mask=$((2**32-2**(32-$mod)))
echo "subnet: $subnet"
echo "base port: $port"
external_subnet=`cat $confPath|grep global.external_subnet|awk -F"=" '{print $2}'`
get_ip_from_subnet $external_subnet
external_ip=$ip
enableExternalServer=true
# external ip和internal ip一致或external ip为127.0.0.1时不启动external server
if [ $internal_ip = $external_ip -o $external_ip = "127.0.0.1" ]
# 对prefix再取一次模,为了支持10.182.26.50/22这种格式
prefix=$(($prefix&$mask))
for i in `/sbin/ifconfig -a|grep inet|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
do
# 把ip转换成整数
ip_int=`echo $i|awk -F. '{printf "%d\n", ($1*(2^24))+($2*(2^16))+($3*(2^8))+$4}'`
if [ $(($ip_int&$mask)) -eq $prefix ]
then
ip=$i
break
fi
done

if [ -z "$ip" ]
then
enableExternalServer=false
else
echo "external_ip: $external_ip"
echo "no ip matched!\n"
return 1
fi

if [ "$1" = "all" ]
then
ret=`ls ${dataDir} |grep chunkserver| sed 's/[^0-9]//g'`
ret=`ls ${dataDir} |grep chunkserver|sed 's/[^0-9]//g'`
for i in $ret
do
start_one $i
Expand Down Expand Up @@ -149,15 +129,15 @@ function start_one() {
-enableChunkfilepool={{ enable_chunkfilepool }} \
-chunkFilePoolDir=${dataDir}/chunkserver$1 \
-chunkFilePoolMetaPath=${dataDir}/chunkserver$1/chunkfilepool.meta \
-chunkServerIp=$internal_ip \
-enableExternalServer=$enableExternalServer \
-chunkServerExternalIp=$external_ip \
-chunkServerIp=$ip \
-chunkServerPort=$((${port}+${1})) \
-chunkServerMetaUri=local://${dataDir}/chunkserver$1/chunkserver.dat \
-chunkServerStoreUri=local://${dataDir}/chunkserver$1/ \
-copySetUri=local://${dataDir}/chunkserver$1/copysets \
-raftSnapshotUri=curve:///data/chunkserver$1/copysets \
-raftSnapshotUri=curve://${dataDir}/chunkserver$1/copysets \
-recycleUri=local://${dataDir}/chunkserver$1/recycler \
-graceful_quit_on_sigterm=true \
-raft_sync_meta=true \
-raft_sync_segments=true \
-graceful_quit_on_sigterm=true \
-log_dir=${dataDir}/log/chunkserver$1 > /dev/null 2>&1 &
Expand Down Expand Up @@ -215,9 +195,8 @@ function restart() {
}

function wait_stop() {
# wait 3秒钟让它退出
retry_times=0
while [ $retry_times -le 3 ]
# 确认chunkserver已经停掉再启动
while true
do
((retry_times=$retry_times+1))
ps -efl|grep -w "${dataDir}/chunkserver$1"|grep -v grep > /dev/null 2>&1
Expand All @@ -229,13 +208,6 @@ function wait_stop() {
break
fi
done
# 如果进程还在,就kill -9
ps -efl|grep -w "${dataDir}/chunkserver$1"|grep -v grep > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "The process of chunkserver$1 still exists after 3s, now kill -9 it"
kill -9 `ps -efl|grep -w ${dataDir}/chunkserver$1|grep -v grep|awk '{print $4}'`
fi
}

function status() {
Expand Down Expand Up @@ -267,8 +239,6 @@ function status_one() {
fi
}

confirm=true

function deploy() {
if [ $# -lt 1 ]
then
Expand All @@ -285,12 +255,13 @@ function deploy() {
fi
if [ "$1" = "all" ]
then
#deploy_all;
deploy_all;
return $?
fi
if [ $# -eq 2 ]
then
#deploy_one $@;
do_confirm;
deploy_one $@;
return $?
fi
usage;
Expand Down
6 changes: 3 additions & 3 deletions curvefs_python/curvefs_tool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env python
# coding=utf-8

#
# Copyright (c) 2020 NetEase Inc.
#
Expand All @@ -14,9 +17,6 @@
# limitations under the License.
#

#!/usr/bin/env python
# coding=utf-8

import curvefs
import parser
import time
Expand Down
7 changes: 0 additions & 7 deletions mk-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,6 @@ if [ $? -ne 0 ]
then
exit
fi
cp -r tools/snaptool build/curve-tools/usr/bin/snaptool-lib
cp tools/snaptool/snaptool build/curve-tools/usr/bin/snaptool
chmod a+x build/curve-tools/usr/bin/snaptool
if [ $? -ne 0 ]
then
exit
fi
mkdir -p build/curve-chunkserver/usr/bin
if [ $? -ne 0 ]
then
Expand Down
7 changes: 0 additions & 7 deletions mk-tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ if [ $? -ne 0 ]
then
exit
fi
cp -r tools/snaptool build/curve/curve-tools/bin/snaptool-lib
cp tools/snaptool/snaptool build/curve/curve-tools/bin/snaptool
chmod a+x build/curve/curve-tools/bin/snaptool
if [ $? -ne 0 ]
then
exit
fi
# curve-chunkserver
mkdir -p build/curve/curve-chunkserver/bin
if [ $? -ne 0 ]
Expand Down
Loading

0 comments on commit fb72406

Please sign in to comment.