simdht优化

pull/109/head
Mr Chen 6 years ago
parent 25cd5bf054
commit 649fb50834
  1. 3
      data/sql/default.sql
  2. 39
      plugins/simdht/workers/simdht_worker.py
  3. 31
      scripts/install_centos.sh

@ -47,7 +47,8 @@ CREATE TABLE IF NOT EXISTS `firewall` (
INSERT INTO `firewall` (`id`, `port`, `ps`, `addtime`) VALUES
(1, '80', '网站默认端口', '0000-00-00 00:00:00'),
(2, '7200', 'WEB面板', '0000-00-00 00:00:00'),
(3, '22', 'SSH远程管理服务', '0000-00-00 00:00:00');
(3, '22', 'SSH远程管理服务', '0000-00-00 00:00:00')
(3, '888', 'phpMyAdmin默认端口', '0000-00-00 00:00:00');

@ -129,6 +129,28 @@ def get_neighbor(target, nid, end=10):
return target[:end] + nid[end:]
def writeFile(filename, str):
# 写文件内容
try:
fp = open(filename, 'w+')
fp.write(str)
fp.close()
return True
except:
return False
def readFile(filename):
# 读文件内容
try:
fp = open(filename, 'r')
fBody = fp.read()
fp.close()
return fBody
except:
return False
class KNode(object):
def __init__(self, nid, ip, port):
@ -480,13 +502,26 @@ class DBDataCheck(Master):
Master.__init__(self)
self.setDaemon(True)
def get_start_id(self):
file = '../start_pos.pl'
if os.path.exists(file):
c = readFile(file)
return int(c)
else:
return 0
def set_start_id(self, start_id):
file = '../start_pos.pl'
writeFile(file, str(start_id))
return True
def check_db_data(self):
max_data = self.query('select max(id) from search_hash')
max_id = max_data[0][0]
min_data = self.query('select min(id) from search_hash')
min_id = min_data[0][0]
min_id = self.get_start_id()
self.set_start_id(max_id)
print 'min_id', min_id, 'max_id', max_id, 'ok!'

@ -16,6 +16,37 @@ if [ ! -f /usr/bin/applydeltarpm ];then
fi
if [ -f "/etc/init.d/iptables" ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
service iptables save
iptables_status=`service iptables status | grep 'not running'`
if [ "${iptables_status}" == '' ];then
service iptables restart
fi
fi
if [ "${isVersion}" == '' ];then
if [ ! -f "/etc/init.d/iptables" ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --permanent --zone=public --add-port=22/tcp
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=888/tcp
firewall-cmd --permanent --zone=public --add-port=7200/tcp
firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
firewall-cmd --reload
fi
fi
yum install -y wget curl unzip zip
# if [ ! -d '/www/server/mdserver-web' ];then

Loading…
Cancel
Save