初始化服务器配置:
安装screen:
yum install screen
安装python以及包管理工具
yum install python36
yum install python36-pip
安装所需要的模块
vim requirements.txt
pip3.6 install -r requirements.txt
安装uwsgi
pip3.6 install uwsgi
yum install python36-devel
pip3.6 install uwsgi
uwsgi --version
复制数据一定要压缩
/root/backend/aaa_xwk_data
tar -zcvf /root/backend/aaa_xwk_data/zombies.tar.gz zombies
cp zombies.tar.gz /root
tar -zxvf /root/zombies.tar.gz
表删除操作,用户表,用户信息表,用户统计表不删除,用户统计表自动清空数据,如果不是,更新为0
删除用户收藏,用户关注,用户点赞,用户帖子,用户心愿
mysql删除:
DELETE FROM app.user_favorite;
DELETE FROM app.user_follow;
DELETE FROM app.user_like;
DELETE FROM app.user_post; 删除152万108秒
DELETE FROM app.user_wish;
mongodb删除:
drop comment
drop post
drop image
240万数据使用两台4G8核,mongdb进行limit(120万),skip(120万),python多进程,脚本设置进程数20个,每台机器速度插入10+/s
screen -S gene_posts_01
/root/backend/services/app
export INSERT_SP=1
uwsgi --http :20001 -w app.main
screen -S gene_posts_02
cd /root/backend/services/app
# export INSERT_SP=1 微服务自己的main.py设置环境变量,用os.get()进入不同任务
uwsgi --http :20002 -w app.main
杀掉uwsgi
ps -ef | grep 19999 | awk '{print $2}' | xargs kill -9