
1、用线程池来更新,将更新代码提交到线程池中,由线程池调度入。
2、执行模块不管更新结果,只需将更新任务放入一个队列中然后直接返回。
3、使用阻塞队列放更新任务,用守护线程poll的队列中的任务。
可以用shell写个脚本批量添加mysql用户:
#!/bin/bashi=$1
MAX_INSERT_ROW_COUNT=$2
while [ $i -le $MAX_INSERT_ROW_COUNT ]
do
mysql -uopensips -popensipsrw opensips -e "insert into subscriber(username,password) values ('10$i',10$i)"
d=$(date +%M-%d\ %H\:%m\:%S)
echo "INSERT username 10$i on $d"
i=$((i+1))
sleep 0.05
done
exit 0
待执行的SQL文件(createuser.sql)–批量添加mysql账户的语句grant all privileges on sq_hehe.* to hehe@localhost identified by “heiq”grant all privileges on sq_7car.* to 7car@localhost identified by “77sq”flush privileges执行createuser.sql文件中的语句:mysql -u用户名 -p密码 -h主机地址(localhost) <createuser.sql
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)