-ttyu0 /usr/libexec/getty std.9600 dialup off secure +ttyu0 /usr/libexec/getty std.9600 dialup on secure
wtorek, 29 października 2013
FreeBSD access via Xen console
To allow access via xen console you need to change /etc/ttys:
Than add few lines into /boot/loader.conf :
boot_multicons="YES" boot_serial="YES" comconsole_speed=9600 console="comconsole,vidconsole"
Now you can restart server.
Now you can access to FreeBSD console via xen:
[root@xenserver1 ~]# xl console "FreeBSD 9.2" FreeBSD/amd64 (tanatos) (ttyu0) login:
piątek, 25 października 2013
Xen add new virtual disc
Once I need to attach new disk on my VM machine.
To do this I need make steps below :
2) Create virtual disc:
3) Check virtual machine UUID for whom virtual disc should be attched:
In my case it was FreeBSD 9.2 (uuid=a79bc6f8-54d7-a562-ba14-4f50db2efc9b)
5) Create virtual disc attached to VM:
6) Optionally if you have Xen tools on board you can plug virtual disc live.
If everything goes right you should have new discs attached and working on virtual machine.
On system:
On Xen:
1) Get storage UUID:
[root@xenserver1 ~]# xe sr-list
uuid ( RO) : 4e98e18e-1215-4fdb-baec-924bbef2a67e
name-label ( RW): Remote ISO Library on: /mnt/iso_import
name-description ( RW):
host ( RO): xenserver1
type ( RO): iso
content-type ( RO): iso
uuid ( RO) : f30a1ead-37f2-0e3c-9583-073c176fc111
name-label ( RW): Removable storage
name-description ( RW):
host ( RO): xenserver1
type ( RO): udev
content-type ( RO): disk
uuid ( RO) : 419c98d3-1d98-3049-c579-439c31b33fd4
name-label ( RW): XenServer Tools
name-description ( RW): XenServer Tools ISOs
host ( RO): xenserver1
type ( RO): iso
content-type ( RO): iso
uuid ( RO) : a9329bfa-e13e-2edd-8414-5920f03f27e5
name-label ( RW): ISOS
name-description ( RW):
host ( RO): xenserver1
type ( RO): iso
content-type ( RO): iso
uuid ( RO) : cb128245-3dcb-9de6-319d-681cede9553f
name-label ( RW): DVD drives
name-description ( RW): Physical DVD drives
host ( RO): xenserver1
type ( RO): udev
content-type ( RO): iso
uuid ( RO) : f6375e1e-0ab7-b11c-e9dd-677da4436e15
name-label ( RW): Local storage
name-description ( RW):
host ( RO): xenserver1
type ( RO): lvm
content-type ( RO): user
[root@xenserver1 ~]# xe vdi-create name-label="zfs1" sr-uuid=f6375e1e-0ab7-b11c-e9dd-677da4436e15 type=user sm-config:type=raw virtual-size=10GiB
34a899b3-b3dd-4531-aee9-1fafb57517ca
[root@xenserver1 ~]# xe vdi-create name-label="zfs2" sr-uuid=f6375e1e-0ab7-b11c-e9dd-677da4436e15 type=user sm-config:type=raw virtual-size=10GiB
20c384f6-0504-4c7f-a3cf-08d28c6c0dc6
[root@xenserver1 ~]# xe vdi-list name-label=zfs1
uuid ( RO) : 34a899b3-b3dd-4531-aee9-1fafb57517ca
name-label ( RW): zfs1
name-description ( RW):
sr-uuid ( RO): f6375e1e-0ab7-b11c-e9dd-677da4436e15
virtual-size ( RO): 10737418240
sharable ( RO): false
read-only ( RO): false
[root@xenserver1 ~]# xe vdi-list name-label=zfs2
uuid ( RO) : 20c384f6-0504-4c7f-a3cf-08d28c6c0dc6
name-label ( RW): zfs2
name-description ( RW):
sr-uuid ( RO): f6375e1e-0ab7-b11c-e9dd-677da4436e15
virtual-size ( RO): 10737418240
sharable ( RO): false
read-only ( RO): false
[root@xenserver1 ~]# xe vm-list
uuid ( RO) : 68ce65a4-01ec-4a23-9016-011aa20e59cf
name-label ( RW): Control domain on host: xenserver1
power-state ( RO): running
uuid ( RO) : 66a6fcc2-b5b9-1eb9-cd26-c26d8df1e204
name-label ( RW): Hadoop-master
power-state ( RO): running
uuid ( RO) : a79bc6f8-54d7-a562-ba14-4f50db2efc9b
name-label ( RW): FreeBSD 9.2
power-state ( RO): running
uuid ( RO) : 8ac1c052-8448-6d9b-0a55-6e91e5be406c
name-label ( RW): FreeBSD10
power-state ( RO): halted
uuid ( RO) : 03070e1e-2b04-5e4b-87f9-5db7d69131bb
name-label ( RW): Hadoop-slave2
power-state ( RO): running
uuid ( RO) : d122b3bf-e914-83b0-5761-1430f205fa9c
name-label ( RW): Hadoop-slave1
power-state ( RO): running
4) Get allowed numbers for VBD devices:
[root@xenserver1 ~]# xe vm-param-get uuid=a79bc6f8-54d7-a562-ba14-4f50db2efc9b param-name=allowed-VBD-devices 1; 2
[root@xenserver1 ~]# xe vbd-create device=1 vm-uuid=a79bc6f8-54d7-a562-ba14-4f50db2efc9b vdi-uuid=34a899b3-b3dd-4531-aee9-1fafb57517ca bootable=false mode=RW type=Disk f43711c3-be1e-a869-8888-408d94a70656 [root@xenserver1 ~]# xe vbd-create device=2 vm-uuid=a79bc6f8-54d7-a562-ba14-4f50db2efc9b vdi-uuid=20c384f6-0504-4c7f-a3cf-08d28c6c0dc6 bootable=false mode=RW type=Disk 5dcf7ad9-f4ec-b3e3-ea0c-8edd0d35d53d
[root@xenserver1 ~]# xe vbd-plug uuid=f43711c3-be1e-a869-8888-408d94a70656
shamrock@tanatos:~ % dmesg | grep xbd xbd0: 30720MBat device/vbd/768 on xenbusb_front0 xbd0: attaching as ada0 xbd1: 10240MB at device/vbd/5632 on xenbusb_front0 xbd1: attaching as ada2 xbd2: 10240MB at device/vbd/832 on xenbusb_front0 xbd2: attaching as ada1
[root@xenserver1 ~]# xe vbd-list vm-name-label=FreeBSD\ 9.2
uuid ( RO) : 5dcf7ad9-f4ec-b3e3-ea0c-8edd0d35d53d
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
vm-name-label ( RO): FreeBSD 9.2
vdi-uuid ( RO): 20c384f6-0504-4c7f-a3cf-08d28c6c0dc6
empty ( RO): false
device ( RO): hdc
uuid ( RO) : f43711c3-be1e-a869-8888-408d94a70656
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
vm-name-label ( RO): FreeBSD 9.2
vdi-uuid ( RO): 34a899b3-b3dd-4531-aee9-1fafb57517ca
empty ( RO): false
device ( RO): hdb
uuid ( RO) : 17d014d8-0d28-76e9-b6dc-f8944a0c0244
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
vm-name-label ( RO): FreeBSD 9.2
vdi-uuid ( RO): a74f372f-2fcd-4121-a241-bd1e960a069c
empty ( RO): false
device ( RO): hda
środa, 23 października 2013
Create local ISO repository
Create with lvcreate place for repository:
Make proper file system:
Add lines to /ec/rc.local
Result:
[root@xenserver1 ~]# lvcreate -L 30G -n ISO2 VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15
[root@xenserver1 ~]# mkfs.ext3 /dev/VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15/ISO2
[root@xenserver1 ~]# vi /etc/rc.local
ISO=/dev/VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15/ISO2
lvchange -ay $ISO
mount $ISO /mnt/iso_import
It's very important not to change /etc/fstab !!!
Last thing is to mount everything without restart:
[root@xenserver1 ~]# ISO=/dev/VG_XenStorage-f6375e1e-0ab7-b11c-e9dd-677da4436e15/ISO2 [root@xenserver1 ~]# lvchange -ay $ISO [root@xenserver1 ~]# mount $ISO /mnt/iso_import [root@xenserver1 ~]# xe-mount-iso-sr /mnt/iso_import -o bind
[root@xenserver1 ~]# xe sr-list
uuid ( RO) : 4e98e18e-1215-4fdb-baec-924bbef2a67e
name-label ( RW): Remote ISO Library on: /mnt/iso_import
name-description ( RW):
host ( RO): xenserver1
type ( RO): iso
content-type ( RO): iso
uuid ( RO) : f30a1ead-37f2-0e3c-9583-073c176fc111
name-label ( RW): Removable storage
name-description ( RW):
host ( RO): xenserver1
type ( RO): udev
content-type ( RO): disk
uuid ( RO) : 419c98d3-1d98-3049-c579-439c31b33fd4
name-label ( RW): XenServer Tools
name-description ( RW): XenServer Tools ISOs
host ( RO): xenserver1
type ( RO): iso
content-type ( RO): iso
uuid ( RO) : cb128245-3dcb-9de6-319d-681cede9553f
name-label ( RW): DVD drives
name-description ( RW): Physical DVD drives
host ( RO): xenserver1
type ( RO): udev
content-type ( RO): iso
uuid ( RO) : f6375e1e-0ab7-b11c-e9dd-677da4436e15
name-label ( RW): Local storage
name-description ( RW):
host ( RO): xenserver1
type ( RO): lvm
content-type ( RO): user
How to add network interface to VM on Citrix Xen via console
Check interfaces:
Create internal interface - not bounded to any physical interface :
Create tagged network interface bounded to physical NIC:
Example pif-list after adding new interface
Check VM to attach new interface:
we need to know number of devices and vm-uuid.
Attach interface to VM:
Result:
Depends of configuration probably you'll need to shutdown your machine and start it again thus system could determine network interface.
[root@xenserver1 ~]# xe pif-list
uuid ( RO) : cc9937fa-0435-7664-a73a-c9bfa803e50e
device ( RO): eth3
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): e7a75876-ee65-950e-7975-6751eca3795b
uuid ( RO) : 3a5ef383-650a-ded9-d636-4c86a6831443
device ( RO): eth1
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): bd91ea1e-6184-4f7b-6360-0134f39b9751
uuid ( RO) : 4c04ef06-9707-67ac-1859-6e6617d507a7
device ( RO): eth2
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): 8d829397-e8d1-fdc2-b62d-8b23cf6da7dd
uuid ( RO) : 41b55f45-91ff-90e1-0a13-dbb680e744e9
device ( RO): eth0
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): 78613a9f-aede-edc6-39f4-40c4c5883de2
uuid ( RO) : 72ff5545-3d4b-5038-aa15-dc93998b8dab
device ( RO): eth0
currently-attached ( RO): true
VLAN ( RO): 21
network-uuid ( RO): 8310ea88-dad4-c989-19db-5c5fdb8d3edc
[root@xenserver1 ~]# xe network-create name-label="anylan" name-description="anylan for testing" 919b5b1c-201f-fed2-c39d-21946f278bdc
[root@xenserver1 ~]# xe network-create name-label="vlan402" name-description="VLAN 402" d5b6969c-eff4-79b2-0088-7740f8a9b492 [root@xenserver1 ~]# xe vlan-create network-uuid=d5b6969c-eff4-79b2-0088-7740f8a9b492 pif-uuid=41b55f45-91ff-90e1-0a13-dbb680e744e9 vlan=402 7dadd3ec-b8a2-5b40-0855-0ef365dc9f00
[root@xenserver1 ~]# xe pif-list
uuid ( RO) : 7dadd3ec-b8a2-5b40-0855-0ef365dc9f00
device ( RO): eth0
currently-attached ( RO): true
VLAN ( RO): 402
network-uuid ( RO): d5b6969c-eff4-79b2-0088-7740f8a9b492
uuid ( RO) : cc9937fa-0435-7664-a73a-c9bfa803e50e
device ( RO): eth3
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): e7a75876-ee65-950e-7975-6751eca3795b
uuid ( RO) : 3a5ef383-650a-ded9-d636-4c86a6831443
device ( RO): eth1
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): bd91ea1e-6184-4f7b-6360-0134f39b9751
uuid ( RO) : 4c04ef06-9707-67ac-1859-6e6617d507a7
device ( RO): eth2
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): 8d829397-e8d1-fdc2-b62d-8b23cf6da7dd
uuid ( RO) : 41b55f45-91ff-90e1-0a13-dbb680e744e9
device ( RO): eth0
currently-attached ( RO): true
VLAN ( RO): -1
network-uuid ( RO): 78613a9f-aede-edc6-39f4-40c4c5883de2
uuid ( RO) : 72ff5545-3d4b-5038-aa15-dc93998b8dab
device ( RO): eth0
currently-attached ( RO): true
VLAN ( RO): 21
network-uuid ( RO): 8310ea88-dad4-c989-19db-5c5fdb8d3edc
[root@xenserver1 ~]# xe vm-list
uuid ( RO) : 68ce65a4-01ec-4a23-9016-011aa20e59cf
name-label ( RW): Control domain on host: xenserver1
power-state ( RO): running
uuid ( RO) : 66a6fcc2-b5b9-1eb9-cd26-c26d8df1e204
name-label ( RW): Hadoop-master
power-state ( RO): running
uuid ( RO) : a79bc6f8-54d7-a562-ba14-4f50db2efc9b
name-label ( RW): FreeBSD 9.2
power-state ( RO): running
uuid ( RO) : 8ac1c052-8448-6d9b-0a55-6e91e5be406c
name-label ( RW): FreeBSD10
power-state ( RO): halted
uuid ( RO) : 03070e1e-2b04-5e4b-87f9-5db7d69131bb
name-label ( RW): Hadoop-slave2
power-state ( RO): running
uuid ( RO) : d122b3bf-e914-83b0-5761-1430f205fa9c
name-label ( RW): Hadoop-slave1
power-state ( RO): running
[root@xenserver1 ~]# xe vif-list vm-name-label=FreeBSD\ 9.2
uuid ( RO) : 49a107e2-0e81-a9dd-0595-218c07fe1af8
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
device ( RO): 2
network-uuid ( RO): 56d7fd62-ba47-c12c-e371-bc7908739ad1
uuid ( RO) : 03932dbf-d7e4-ed7d-d649-ac431a97d962
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
device ( RO): 1
network-uuid ( RO): 8310ea88-dad4-c989-19db-5c5fdb8d3edc
[root@xenserver1 ~]# xe vif-create network-uuid=d5b6969c-eff4-79b2-0088-7740f8a9b492 vm-uuid=a79bc6f8-54d7-a562-ba14-4f50db2efc9b device=3 mac=random 758cf24a-2904-f3aa-8ed4-17d6ffebf032 [root@xenserver1 ~]# xe vif-create network-uuid=919b5b1c-201f-fed2-c39d-21946f278bdc vm-uuid=a79bc6f8-54d7-a562-ba14-4f50db2efc9b device=4 mac=random 3504d19f-2413-e066-6d30-1878adfbd117
[root@xenserver1 ~]# xe vif-list vm-name-label=FreeBSD\ 9.2
uuid ( RO) : 49a107e2-0e81-a9dd-0595-218c07fe1af8
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
device ( RO): 2
network-uuid ( RO): 56d7fd62-ba47-c12c-e371-bc7908739ad1
uuid ( RO) : 758cf24a-2904-f3aa-8ed4-17d6ffebf032
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
device ( RO): 3
network-uuid ( RO): d5b6969c-eff4-79b2-0088-7740f8a9b492
uuid ( RO) : 03932dbf-d7e4-ed7d-d649-ac431a97d962
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
device ( RO): 1
network-uuid ( RO): 8310ea88-dad4-c989-19db-5c5fdb8d3edc
uuid ( RO) : 3504d19f-2413-e066-6d30-1878adfbd117
vm-uuid ( RO): a79bc6f8-54d7-a562-ba14-4f50db2efc9b
device ( RO): 4
network-uuid ( RO): 919b5b1c-201f-fed2-c39d-21946f278bdc
Etykiety:
citrix,
cli,
command line,
virtual interface,
vlan,
vm,
xen
wtorek, 22 października 2013
FreeBSD 9.2 XEN xenbusb_nop_confighook_cb
Recently I tried run FreeBSD 9.2 on my Citrix Xen machine with HVM support.
After booting I got error:
xenbusb_nop_confighook_cb
This error got me confused. I'd searched awhile and found solution :
http://web.archiveorange.com/archive/v/jbzpKsnhTPhFFEuQuYTP
root@pruebas:/root # diff -u /usr/src/sys/kern/subr_autoconf.c-defecto /usr/src/sys/kern/subr_autoconf.c
--- /usr/src/sys/kern/subr_autoconf.c-defecto 2012-10-10 13:51:27.000000000 +0200
+++ /usr/src/sys/kern/subr_autoconf.c 2012-10-10 18:21:51.000000000 +0200
@@ -133,16 +133,17 @@
/* Block boot processing until all hooks are disestablished. */
mtx_lock(&intr_config_hook_lock);
warned = 0;
- while (!TAILQ_EMPTY(&intr_config_hook_list)) {
+ /* while (!TAILQ_EMPTY(&intr_config_hook_list)) { */
if (msleep(&intr_config_hook_list, &intr_config_hook_lock,
0, "conifhk", WARNING_INTERVAL_SECS * hz) ==
EWOULDBLOCK) {
+ printf("\n\n SARENET Individual lock name antes de unlock es : %s", intr_config_hook_lock.lock_object.lo_name);
mtx_unlock(&intr_config_hook_lock);
warned++;
run_interrupt_driven_config_hooks_warning(warned);
mtx_lock(&intr_config_hook_lock);
}
- }
+ /* } */
mtx_unlock(&intr_config_hook_lock);
}TAILQ_EMPTY is at queue.h :
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
Etykiety:
citrix,
freebsd 9.2,
vm,
xen,
xenbusb_nop_confighook_cb
środa, 16 października 2013
Columbus day
Special offer from Packt Publishing - all books 50% off has been extended to 21 October 2013 - that's great news
http://bit.ly/1bqvB29
http://bit.ly/1bqvB29
Etykiety:
books,
columbus day,
packtpub,
special offer
środa, 9 października 2013
Postgresql replication book review
http://www.packtpub.com/postgresql-replication/book
Recently I got book about postgresql replication for review .
This book is great.
It describes different replication methods available in postgres in very easy way.
Besides that, it describes how replication mechanisms work, what you should know about designing database and many other aspects related to databases.
The book contains examples which can be used to one's practice.
In this book there are usefull things not only for database administrator but also for regular user who wants to know better how it works.
Recently I got book about postgresql replication for review .
This book is great.
It describes different replication methods available in postgres in very easy way.
Besides that, it describes how replication mechanisms work, what you should know about designing database and many other aspects related to databases.
The book contains examples which can be used to one's practice.
In this book there are usefull things not only for database administrator but also for regular user who wants to know better how it works.
Etykiety:
book,
postgresql,
replication
poniedziałek, 7 października 2013
Read linux dmesg with date
Simple script to read dmesg from linux (contains real date no miliseconds)
----------------------------------------------------------------------------------------------------------
#!/usr/bin/python
import sys
import re
import time
import datetime
import fileinput
import os
try:
uptime = open('/proc/uptime','r')
except IOError as (errno, strerror):
print "Wystapil blad otwarcia pliku :\n %s\n" % (strerror)
czas = time.time()
uptime_seconds = czas-float(uptime.readline().split()[0])
p = os.popen('dmesg')
for line in p.readlines():
re1='.*?'
re2='(\\d+)'
re3='(\\.)'
re4='(\\d+)'
rg = re.compile(re1+re2+re3+re4,re.IGNORECASE|re.DOTALL)
m = rg.search(line)
if m:
int1=float(m.group(1)+m.group(2)+m.group(3))
szukaj=(m.group(1)+m.group(2)+m.group(3))
czas = uptime_seconds + int1
czas = datetime.datetime.fromtimestamp(int(czas)).strftime('%Y-%m-%d %H:%M:%S')
zwrot = re.sub(szukaj,czas,line.rstrip(),1)
print zwrot
----------------------------------------------------------------------------------------------------------
#!/usr/bin/python
import sys
import re
import time
import datetime
import fileinput
import os
try:
uptime = open('/proc/uptime','r')
except IOError as (errno, strerror):
print "Wystapil blad otwarcia pliku :\n %s\n" % (strerror)
czas = time.time()
uptime_seconds = czas-float(uptime.readline().split()[0])
p = os.popen('dmesg')
for line in p.readlines():
re1='.*?'
re2='(\\d+)'
re3='(\\.)'
re4='(\\d+)'
rg = re.compile(re1+re2+re3+re4,re.IGNORECASE|re.DOTALL)
m = rg.search(line)
if m:
int1=float(m.group(1)+m.group(2)+m.group(3))
szukaj=(m.group(1)+m.group(2)+m.group(3))
czas = uptime_seconds + int1
czas = datetime.datetime.fromtimestamp(int(czas)).strftime('%Y-%m-%d %H:%M:%S')
zwrot = re.sub(szukaj,czas,line.rstrip(),1)
print zwrot
środa, 2 października 2013
MongoDB aggregation
MongoDB aggregation examples:
db.posts.aggregate({$unwind:"$comments"},{$group:{_id:"$comments.author",count:{$sum:1}}},{$sort:{count:1}})
db.zip.aggregate([{$match:{$or:[{state:"CA"},{state:"NY"}]}}, {$group:{_id:{city:"$city",state:"$state"}, pop:{$sum:"$pop"}}}, {$match:{pop:{$gt:25000}}}, {$group:{_id:"$state", average:{$avg:"$pop"}}}])
db.grades.aggregate({$unwind:"$scores"} , {$match:{"scores.type":{$nin:["quiz"]}}},{$group:{_id:{student_id:"$student_id",class_id:"$class_id"},avg:{$avg:"$scores.score"}}},{$group:{_id:"$_id.class_id",average:{$avg:"$avg"}}})
db.zip.aggregate( [ {$project : {city:{$substr:["$city",0,1]},pop:1}}, {$sort : {city : 1}}, {$match: {city: /^\d.*$/}} , {$group:{_id:1,pop:{$sum:"$pop"}}}])
Etykiety:
aggregation,
databases,
mongodb
Subskrybuj:
Komentarze (Atom)