1.因为数据库不能用Xftp上传文件了,报错:
-bash: cannot create temp file for here-document: No space left on device
1.1用scp 复制上传文件到服务器也报错:
scp: /home/linxiao/import_check_17.sh: No space left on device
1.2 在服务器上 按tab 键不再补充提示时:
也可能是
排查:
解决:删除/var 或者 /usr 的 不必要的log文件
2.mongoimport 导入脚本(实现了json文件的批量导入mongo),打印已经导入成功的json文件名写入到一个txt文件,还有全部到晚的结束信号
#! /bin/bash
import_path=$1
is_first=$2
success_file="$(cd $import_path; cd ..; pwd)/success.txt"
echo $is_first
echo $import_path
if [ "$is_first" = "yes" ]
then
if [ -e $success_file ]
then
echo 'delete-ing success.txt'
(rm -r $success_file)
fi
$(touch $success_file)
fi
declare -a success_files
success_files=(`cat $success_file`)
# path=/backup2/btc_tx/btc_outputlist_tx
nd_impoort_files=$(ls $import_path)
for filename in $nd_impoort_files
do
if ! [[ "${success_files[*]}" =~ ${filename} ]]
then
file="$import_path/$filename"
mongoimport --uri mongodb://datacenter:datacenter123@s-8vbb2c155414aa44.mongodb.zhangbei.rds.aliyuncs.com:3717,s-8vbb1ba3aa777034.mongodb.zhangbei.rds.aliyuncs.com:3717/chain_info_btc_prod?authSource=admin -c transaction --type json --file $file
echo "${filename}" >> $success_file
fi
done
echo "all data had imported success!"
后台运行:
nohup bash import_check.sh /backup2/btc_tx/btc_outputlist_tx &
3.MOGNO 新建db和collection
db.createUser({'user': 'datacenter', 'pwd': 'datacenter123', 'roles':[{'role': 'readWrite', 'db': 'chain_info_btc_prod'}]})
----------------------------------------------------------------------------------------------
user: datacenter,pwd: datacenter123
chain_info_btc_prod
网友评论