コンピューターのいろいろなこと
コンピュータの備忘録
2016年6月2日木曜日
CentOS7 bonding on VMware ESXi 5.5
[root@c7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.0.84
PREFIX=24
GATEWAY=192.168.0.1
DNS1=192.168.0.254
DOMAIN=tsystem.gr.jp
BONDING_OPTS="mode=active-backup miimon=100"
[root@c7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE="Ethernet"
BOOTPROTO=none
HWADDR=00:0C:29:FE:63:2C
NAME="ens32"
UUID="a4fc62df-e4dc-4a98-82b0-ae7597c94c3e"
DEVICE="ens32"
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
[root@c7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens34
HWADDR=00:0C:29:FE:63:36
TYPE=Ethernet
NAME="ens34"
DEVICE=ens34
UUID="f511fbe2-7b69-44ac-a820-32a21a5b77a5"
ONBOOT="yes"
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
[root@c7 ~]#
[root@c7 ~]# cat ts.sh
#!/bin/sh
echo '###############################################################################'
cat /etc/redhat-release
date '+%Y%m%d.%H%M%S'
echo '# ip link show ################################################################'
ip link show
echo '# ip addr show ################################################################'
ip addr show
echo '# ping gw #####################################################################'
ping -c 1 192.168.0.1
echo '###############################################################################'
[root@c7 ~]#
[root@c7 ~]# ./ts.sh
###############################################################################
CentOS Linux release 7.2.1511 (Core)
20160601.232223
# ip link show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
# ip addr show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
inet 192.168.0.84/24 brd 192.168.0.255 scope global bond0
valid_lft forever preferred_lft forever
inet6 240f:6f:ea7e:1:20c:29ff:fefe:632c/64 scope global mngtmpaddr dynamic
valid_lft 297sec preferred_lft 297sec
inet6 fe80::dc3b:f8ff:fe45:d208/64 scope link
valid_lft forever preferred_lft forever
# ping gw #####################################################################
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=0.360 ms
--- 192.168.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.360/0.360/0.360/0.000 ms
###############################################################################
[root@c7 ~]#
[root@c7 ~]# ./ts.sh
###############################################################################
CentOS Linux release 7.2.1511 (Core)
20160601.232434
# ip link show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state DOWN mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
# ip addr show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state DOWN qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
inet 192.168.0.84/24 brd 192.168.0.255 scope global bond0
valid_lft forever preferred_lft forever
inet6 240f:6f:ea7e:1:20c:29ff:fefe:632c/64 scope global mngtmpaddr dynamic
valid_lft 289sec preferred_lft 289sec
inet6 fe80::dc3b:f8ff:fe45:d208/64 scope link
valid_lft forever preferred_lft forever
# ping gw #####################################################################
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=0.341 ms
--- 192.168.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.341/0.341/0.341/0.000 ms
###############################################################################
[root@c7 ~]#
[root@c7 ~]# ./ts.sh
###############################################################################
CentOS Linux release 7.2.1511 (Core)
20160601.232600
# ip link show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
# ip addr show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
inet 192.168.0.84/24 brd 192.168.0.255 scope global bond0
valid_lft forever preferred_lft forever
inet6 240f:6f:ea7e:1:20c:29ff:fefe:632c/64 scope global mngtmpaddr dynamic
valid_lft 275sec preferred_lft 275sec
inet6 fe80::dc3b:f8ff:fe45:d208/64 scope link
valid_lft forever preferred_lft forever
# ping gw #####################################################################
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=0.359 ms
--- 192.168.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.359/0.359/0.359/0.000 ms
###############################################################################
[root@c7 ~]#
[root@c7 ~]# ./ts.sh
###############################################################################
CentOS Linux release 7.2.1511 (Core)
20160601.232647
# ip link show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state DOWN mode DEFAULT qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
# ip addr show ################################################################
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
3: ens34: mtu 1500 qdisc pfifo_fast master bond0 state DOWN qlen 1000
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
6: bond0: mtu 1500 qdisc noqueue state UP
link/ether 00:0c:29:fe:63:2c brd ff:ff:ff:ff:ff:ff
inet 192.168.0.84/24 brd 192.168.0.255 scope global bond0
valid_lft forever preferred_lft forever
inet6 240f:6f:ea7e:1:20c:29ff:fefe:632c/64 scope global mngtmpaddr dynamic
valid_lft 270sec preferred_lft 270sec
inet6 fe80::dc3b:f8ff:fe45:d208/64 scope link
valid_lft forever preferred_lft forever
# ping gw #####################################################################
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=0.321 ms
--- 192.168.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.321/0.321/0.321/0.000 ms
###############################################################################
[root@c7 ~]#
2013年4月27日土曜日
Debian squeezeの、gnomeターミナルで、rvm useがエラーになってしまう。
Debian squeezeの、gnomeターミナルで、rvm useがエラーになってしまう。
indou@cf-t8:~$ rvm list
rvm rubies
ruby-1.9.3-p392 [ x86_64 ]
=* ruby-2.0.0-p0 [ x86_64 ]
=* ruby-2.0.0-p0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
# =* - current && default
# * - default
indou@cf-t8:~$ rvm use 1.9.3
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
2012年11月19日月曜日
2012年10月25日木曜日
rubyのthread
Queue をpopするとき、空だと、Threadは、sleep(stop)するらしい。join中に、すべてのThreadが、sleep(stop)だと、dead lockとなるらしい。
indou@MacBook:work:$ cat ts2.rb
require 'thread'
array_size = ARGV[0].to_i
q = Queue.new
10.times {|i| q.push "no:#{i}"}
q.push nil
arrays = Array.new(array_size) do |i|
Thread.new do
while cnt = q.pop
puts "Thread #{i}: no:#{cnt}"
end
end
end
arrays.each do |t|
t.join
end
puts "finish!!"
indou@MacBook:work:$ ruby ts2.rb 1
Thread 0: job0
Thread 0: job1
Thread 0: job2
Thread 0: job3
Thread 0: job4
Thread 0: job5
Thread 0: job6
Thread 0: job7
Thread 0: job8
Thread 0: job9
finish!!
indou@MacBook:work:$ ruby ts2.rb 2
Thread 0: job0
Thread 0: job2
Thread 0: job3
Thread 0: job4
Thread 0: job5
Thread 0: job6
Thread 0: job7
Thread 0: job8
Thread 0: job9
Thread 1: job1
ts2.rb:17:in `join': deadlock detected (fatal)
from ts2.rb:17:in `block in '
from ts2.rb:16:in `each'
from ts2.rb:16:in `'
indou@MacBook:work:$ diff ts2.rb ts2.2.rb
7c7,10
< q.push nil
---
> array_size.times do
> puts "."
> q.push nil
> end
indou@MacBook:work:$ ruby ts2.2.rb 1
.
Thread 0: job0
Thread 0: job1
Thread 0: job2
Thread 0: job3
Thread 0: job4
Thread 0: job5
Thread 0: job6
Thread 0: job7
Thread 0: job8
Thread 0: job9
finish!!
indou@MacBook:work:$ ruby ts2.2.rb 2
.
.
Thread 0: job0
Thread 0: job1
Thread 0: job2
Thread 0: job3
Thread 0: job4
Thread 0: job5
Thread 0: job6
Thread 0: job8
Thread 0: job9
Thread 1: job7
finish!!
indou@MacBook:work:$
Apple IDの情報が書き換えられていた。
今日、こんなメールが来た。
Apple ID名:************のアカウント情報が08/22/2012に変更されました。
指名
配送または請求先住所
アカウント情報を書き換えた覚えはないので、すぐパスワードを変更。
Apple ID名:************のアカウント情報が08/22/2012に変更されました。
指名
配送または請求先住所
| |
rubyのthreadでエラーが出ない。
このロジック。
ruby 1.8.7だと、正常に動作。
indou@MacBook:work:$ rvm use 1.8.7
Using /Users/indou/.rvm/gems/ruby-1.8.7-p370
indou@MacBook:work:$ ruby thread0.rb
500
Square(500) = 22.3606797749979
300
Square(300) = 17.3205080756888
.
indou@MacBook:work:$
ruby 1.9.3だと、正常に動作しない。
indou@MacBook:work:$ rvm use 1.9.3
Using /Users/indou/.rvm/gems/ruby-1.9.3-p194
indou@MacBook:work:$ ruby thread0.rb
500
300
.
indou@MacBook:work:$
indou@MacBook:work:$ sdiff thread0.rb.bk20121025 thread0.rb
require "thread" require "thread"
q = Queue.new q = Queue.new
t = Thread.new do t = Thread.new do
loop do loop do
n = q.pop n = q.pop
if n.to_i >= 0 if n.to_i >= 0
val = Math::sqrt(n) | begin
puts "Square(#{n}) = #{val}" | val = Math::sqrt(n)
> puts "Square(#{n}) = #{val}"
> rescue Exception => e
> p e
> end
else else
puts "?" puts "?"
end end
end end
end end
while line = gets while line = gets
if line.chop! == "." if line.chop! == "."
break break
else else
q.push(line) q.push(line)
end end
end end
indou@MacBook:work:$
indou@MacBook:work:$ ruby thread0.rb
500
#
.
indou@MacBook:work:$
なんだ。Math::sqrt(n)でエラーになってる。なんで、エラー表示されないんだろう。
indou@MacBook:work:$ cat ts.rb
n = gets
p Math::sqrt(n)
indou@MacBook:work:$ ruby ts.rb
500
ts.rb:3:in `sqrt': can't convert String into Float (TypeError)
from ts.rb:3:in `'
indou@MacBook:work:$
スレッドがなければエラー表示される。
indou@MacBook:work:$ sdiff thread0.rb.bk20121025.1 thread0.rb
require "thread" require "thread"
q = Queue.new q = Queue.new
t = Thread.new do t = Thread.new do
loop do loop do
n = q.pop n = q.pop
if n.to_i >= 0 if n.to_i >= 0
begin | val = Math::sqrt(n.to_i)
val = Math::sqrt(n) | puts "Square(#{n}) = #{val}"
puts "Square(#{n}) = #{val}" <
rescue Exception => e <
p e <
end <
else else
puts "?" puts "?"
end end
end end
end end
while line = gets while line = gets
if line.chop! == "." if line.chop! == "."
break break
else else
q.push(line) q.push(line)
end end
end end
indou@MacBook:work:$
indou@MacBook:work:$ ruby thread0.rb
500
Square(500) = 22.360679774997898
300
Square(300) = 17.320508075688775
.
indou@MacBook:work:$
登録:
投稿 (Atom)