shell脚本在容器云中搭建hadoop集群(四)
2017-09-11 22:24
453 查看
总结一下今天的学习过程
1,上午继续观看学习Python的数据库编程视屏,测试Django项目使用MariaDB数据库,由列表实现数据库表的映射,总结了区别
sqlite: 不需要继承models.Model
class student01():
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=50)
adress = models.CharField(max_length=50)
class Meta:
db_table='student01'
MariaDB:
class User(models.Model):
id = models.AutoField(max_length=11,db_column='UID',primary_key=True)
userName = models.CharField(max_length=255,db_column='username',blank = False)
passWord = models.CharField(max_length=255,db_column='password',blank = False)
cid = models.IntegerField(max_length=11,db_column='CID',blank = False)
class Meta:
db_table = 'user'
testDB.User.cid: (fields.W122) 'max_length' is ignored when used with IntegerField
设置为整形integer,长度不生效
2,中午以及下午还有晚上陆陆续续的师弟师妹来到实验室,感觉队伍又壮大了
3,今天师兄返校,倍感激动,请教了我之前做的使用shell脚本在docker中搭建hadoop的问题:关于sshd服务开启、hadoop容器之间相互免密登录的问题,实现了从节点的sshd以及其的ssh免密登录,感觉看到了曙光,期待明天能有更多的进展。
# !/bin/bash
# start sshd
/usr/sbin/sshd
hadoopsum=
hadoopPwd=
echo $hadoopsum
echo $hadoopPwd
function setupHadoopSalve(){
allhadoopip=''
for ((i=0;i<$hadoopsum;i++));
do
allhadoopip+="\n192.168.2.1$i hadoop$i";
done
allhadoopip+="\n"
echo $allhadoopip
echo "/etc/hosts......."
cat /etc/hosts
cp /etc/hosts /root/hosts.new
echo "/root/hosts.new........"
cat /root/hosts.new
for ss in `cat /root/hosts.new | grep hadoop | awk '{print $1}'`;
do sed -i '/'$ss'.*/d' /root/hosts.new;
done
echo -e "$(cat /root/hosts.new)" > /etc/hosts
cat /etc/hosts
echo -e $allhadoopip >> /etc/hosts
cd ~
rm -rf /root/.ssh
mkdir /root/.ssh
expect -c "set timeout -1;
spawn ssh-keygen -t rsa;
expect {
*(y/n)* {send -- y\r;exp_continue;}
*Enter* {send -- \r;exp_continue;}
}";
expect -c "set timeout -1;
spawn ssh-copy-id localhost;
expect {
*(yes/no)* {send -- yes\r;exp_continue;}
*assword:* {send -- $hadoopPwd\r;exp_continue;}
eof {exit 0;}
}";
for hostname in `hostname`;
do
echo $hostname
expect -c "set timeout -1;
spawn ssh-copy-id $hostname;
expect {
*(yes/no)* {send -- yes\r;exp_continue;}
*assword:* {send -- $hadoopPwd\r;exp_continue;}
eof {exit 0;}
}";
done
}
setupHadoopSalve
for ss in `ps -e | grep sshd | awk '{print $1}'`;
do
kill $ss;
done
/usr/sbin/sshd -D
激动的一天,明天加油!
1,上午继续观看学习Python的数据库编程视屏,测试Django项目使用MariaDB数据库,由列表实现数据库表的映射,总结了区别
sqlite: 不需要继承models.Model
class student01():
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=50)
adress = models.CharField(max_length=50)
class Meta:
db_table='student01'
MariaDB:
class User(models.Model):
id = models.AutoField(max_length=11,db_column='UID',primary_key=True)
userName = models.CharField(max_length=255,db_column='username',blank = False)
passWord = models.CharField(max_length=255,db_column='password',blank = False)
cid = models.IntegerField(max_length=11,db_column='CID',blank = False)
class Meta:
db_table = 'user'
testDB.User.cid: (fields.W122) 'max_length' is ignored when used with IntegerField
设置为整形integer,长度不生效
2,中午以及下午还有晚上陆陆续续的师弟师妹来到实验室,感觉队伍又壮大了
3,今天师兄返校,倍感激动,请教了我之前做的使用shell脚本在docker中搭建hadoop的问题:关于sshd服务开启、hadoop容器之间相互免密登录的问题,实现了从节点的sshd以及其的ssh免密登录,感觉看到了曙光,期待明天能有更多的进展。
# !/bin/bash
# start sshd
/usr/sbin/sshd
hadoopsum=
hadoopPwd=
echo $hadoopsum
echo $hadoopPwd
function setupHadoopSalve(){
allhadoopip=''
for ((i=0;i<$hadoopsum;i++));
do
allhadoopip+="\n192.168.2.1$i hadoop$i";
done
allhadoopip+="\n"
echo $allhadoopip
echo "/etc/hosts......."
cat /etc/hosts
cp /etc/hosts /root/hosts.new
echo "/root/hosts.new........"
cat /root/hosts.new
for ss in `cat /root/hosts.new | grep hadoop | awk '{print $1}'`;
do sed -i '/'$ss'.*/d' /root/hosts.new;
done
echo -e "$(cat /root/hosts.new)" > /etc/hosts
cat /etc/hosts
echo -e $allhadoopip >> /etc/hosts
cd ~
rm -rf /root/.ssh
mkdir /root/.ssh
expect -c "set timeout -1;
spawn ssh-keygen -t rsa;
expect {
*(y/n)* {send -- y\r;exp_continue;}
*Enter* {send -- \r;exp_continue;}
}";
expect -c "set timeout -1;
spawn ssh-copy-id localhost;
expect {
*(yes/no)* {send -- yes\r;exp_continue;}
*assword:* {send -- $hadoopPwd\r;exp_continue;}
eof {exit 0;}
}";
for hostname in `hostname`;
do
echo $hostname
expect -c "set timeout -1;
spawn ssh-copy-id $hostname;
expect {
*(yes/no)* {send -- yes\r;exp_continue;}
*assword:* {send -- $hadoopPwd\r;exp_continue;}
eof {exit 0;}
}";
done
}
setupHadoopSalve
for ss in `ps -e | grep sshd | awk '{print $1}'`;
do
kill $ss;
done
/usr/sbin/sshd -D
激动的一天,明天加油!
相关文章推荐
- shell脚本在容器云中搭建hadoop集群(六)
- shell脚本在容器云中搭建hadoop集群(七)
- shell脚本在容器云中搭建hadoop集群(二)
- shell脚本在容器云中搭建hadoop集群(五)
- 在linux下使用shell脚本自动化完成hadoop集群搭建
- shell脚本在容器云中搭建hadoop集群(一)
- hadoop集群的搭建脚本及构思(一):用户和用户权限
- shell脚本搭建容器云(二)
- 【甘道夫】Hadoop2.2.0集群启动和停止Shell脚本
- 一键启动hadoop集群、zookeeper集群、spark集群shell脚本
- Hadoop概念学习系列之Java调用Shell命令和脚本,致力于hadoop/spark集群(三十六)
- hadoop集群一键自动启动和自动关闭shell脚本 原创 2017年07月23日 17:58:45
- shell 脚本实战笔记(7)--集群网络相关知识和环境搭建
- 搭建ubuntu14.04的hadoop集群【docker容器充当服务器】
- 【甘道夫】Hadoop2.2.0集群启动和停止Shell脚本
- hadoop MapReduce集群模式调整匹配及shell脚本处理
- hadoop集群的搭建脚本及构思(N):一个简化的Hadoop+Spark on Yarn集群快速搭建
- shell脚本搭建容器云完结篇(三)
- 使用shell脚本实现自动化部署hadoop集群
- hadoop集群机架感应配置的简单过程(shell脚本版本)