Skip to content

Margus Roo –

If you're inventing and pioneering, you have to be willing to be misunderstood for long periods of time

  • Cloudbreak Autoscale fix
  • Endast

Category: Linux

Glusterfs

Posted on October 26, 2010 - October 28, 2010 by margusja

Oli ka aeg. Kes see ikka tänapäeval ühe serveriga storaget peab. Igaljuhul olen ma oma esimese glusterfs instantsi käivitamise üle nii uhke, et lausa panen siia. Mine tea ehk lisan endale ka hiljem väikese how-to

Download

Docs

storage1 masinas peab käima glasterfs-server

[root@storage1 ~]# /etc/init.d/glusterfsd status
glusterfsd (pid 23029 4386) is running...
[root@storage1 ~]#

loome esialgu kahest storagest koosneva volume (seda võib teha suvalises masinas kus glusterd käib kus on gluster CLI olemas)

[root@storage2 ~]# gluster volume create storage transport tcp 192.168.1.202:/mnt/storage 192.168.1.203:/mnt/storage
Creation of volume storage has been successful
[root@storage2 ~]# gluster volume info storage

Volume Name: storage
Type: Distribute
Status: Created
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: 192.168.1.202:/mnt/storage
Brick2: 192.168.1.203:/mnt/storage
[root@storage2 ~]#

Käivitame

[root@storage2 ~]# gluster volume start storage
Starting volume storage has been successful

Klient masinas mount-me glusterfs-i.

[root@client ~]# mount
/dev/xvda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/xvda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
[root@client ~]# mount -t glusterfs 192.168.1.203:storage /mnt/glusterfs/
[root@client ~]# mount
/dev/xvda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/xvda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
glusterfs#192.168.1.203:storage on /mnt/glusterfs type fuse (rw,allow_other,default_permissions,max_read=131072)
[root@client ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 1.9G 1.3G 524M 71% /
/dev/xvda1 99M 13M 81M 14% /boot
tmpfs 250M 0 250M 0% /dev/shm
glusterfs#192.168.1.203:storage
942M 21M 873M 3% /mnt/glusterfs

lisame uue node

[root@storage2 ~]# gluster volume add-brick storage 192.168.1.201:/mnt/storage
Add Brick successful
[root@storage2 ~]# gluster volume info storage

Volume Name: storage
Type: Distribute
Status: Started
Number of Bricks: 3
Transport-type: tcp
Bricks:
Brick1: 192.168.1.202:/mnt/storage
Brick2: 192.168.1.203:/mnt/storage
Brick3: 192.168.1.201:/mnt/storage

Kliendi masinas peale mõninga aja möödumist

[root@client ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 1.9G 1.3G 524M 71% /
/dev/xvda1 99M 13M 81M 14% /boot
tmpfs 250M 0 250M 0% /dev/shm
glusterfs#192.168.1.203:storage
1.2G 25M 1.1G 3% /mnt/glusterfs

host1:

Vajalikud pakid repost:

[root@host3 ~]# yum install libibverbs-devel fuse-devel fuse

Posted in LinuxLeave a comment

MD5 decrypt

Posted on October 18, 2010 by margusja

Miski siin maailmas ei ole enam püha, isegi mitte enamlevinud md5 encrypted stringid

Posted in Linux, TurvalisusLeave a comment

DNS tool DIG hints

Posted on October 15, 2010 - October 15, 2010 by margusja

Olen aastaid dig nimelist tööriista kasutanud kuid AXFR päring oli mul kas siis teadmata või kuidagi kahe silma vahele jäänud. Lausa häbi.

Igaljuhul panen siia endale kirja, ehk tuleb veel midagi dig-i kohta huvitavat

AXFR – annab siis päritava domeeni kohta kogu seti juhul kui AXFR lubatud (allow-transfer { }; option plokis)

[Fri Oct 15 19:54:42 margusja@IRack dig AXFR roo.ee @ns2.okia.ee

; <<>> DiG 9.6.0-APPLE-P2 <<>> AXFR roo.ee @ns2.okia.ee
;; global options: +cmd
roo.ee. 14400 IN SOA ns3.okia.ee. hostmaster.roo.ee. 2010072003 14400 3600 1209600 86400
roo.ee. 14400 IN NS ns2.okia.ee.
roo.ee. 14400 IN NS ns3.okia.ee.
roo.ee. 14400 IN A 90.190.106.29
roo.ee. 14400 IN MX 10 mail.roo.ee.
roo.ee. 14400 IN TXT "v=spf1 a mx ip4:90.190.106.29 ~all"
ftp.roo.ee. 14400 IN A 90.190.106.29
localhost.roo.ee. 14400 IN A 127.0.0.1
mail.roo.ee. 14400 IN A 90.190.106.29
margus.roo.ee. 14400 IN CNAME roo.ee.
pop.roo.ee. 14400 IN A 90.190.106.29
smtp.roo.ee. 14400 IN A 90.190.106.29
www.roo.ee. 14400 IN A 90.190.106.29
roo.ee. 14400 IN SOA ns3.okia.ee. hostmaster.roo.ee. 2010072003 14400 3600 1209600 86400
;; Query time: 173 msec
;; SERVER: 67.207.134.150#53(67.207.134.150)
;; WHEN: Fri Oct 15 19:57:38 2010
;; XFR size: 14 records (messages 1, bytes 376)

[Fri Oct 15 19:57:38 margusja@IRack

PTR päring. Reverse päringud. Samuti hea näha ISP

[Fri Oct 15 21:12:59 margusja@IRack dig 23.106.190.90.in-addr.arpa PTR

; <<>> DiG 9.6.0-APPLE-P2 <<>> 23.106.190.90.in-addr.arpa PTR
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12135 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3 ;; QUESTION SECTION: ;23.106.190.90.in-addr.arpa. IN PTR ;; ANSWER SECTION: 23.106.190.90.in-addr.arpa. 10800 IN PTR 90-190-106-23-dbweb.ee. ;; AUTHORITY SECTION: 106.190.90.in-addr.arpa. 3497 IN NS ns2.elion.ee. 106.190.90.in-addr.arpa. 3497 IN NS ns.elion.ee. ;; ADDITIONAL SECTION: ns.elion.ee. 4864 IN A 213.168.18.146 ns.elion.ee. 9032 IN AAAA 2001:7d0::7:215:60ff:fe0c:d578 ns2.elion.ee. 4272 IN A 195.50.193.163 ;; Query time: 28 msec ;; SERVER: 192.168.1.254#53(192.168.1.254) ;; WHEN: Fri Oct 15 21:13:19 2010 ;; MSG SIZE rcvd: 181 [Fri Oct 15 21:13:19 margusja@IRack

Või

[Fri Oct 15 21:13:19 margusja@IRack dig -x 90.190.106.23

; <<>> DiG 9.6.0-APPLE-P2 <<>> -x 90.190.106.23
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3581 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3 ;; QUESTION SECTION: ;23.106.190.90.in-addr.arpa. IN PTR ;; ANSWER SECTION: 23.106.190.90.in-addr.arpa. 10800 IN PTR 90-190-106-23-dbweb.ee. ;; AUTHORITY SECTION: 106.190.90.in-addr.arpa. 10386 IN NS ns.elion.ee. 106.190.90.in-addr.arpa. 10386 IN NS ns2.elion.ee. ;; ADDITIONAL SECTION: ns.elion.ee. 4544 IN A 213.168.18.146 ns.elion.ee. 8686 IN AAAA 2001:7d0::7:215:60ff:fe0c:d578 ns2.elion.ee. 3929 IN A 195.50.193.163 ;; Query time: 30 msec ;; SERVER: 192.168.1.254#53(192.168.1.254) ;; WHEN: Fri Oct 15 21:15:55 2010 ;; MSG SIZE rcvd: 181 [Fri Oct 15 21:15:55 margusja@IRack

Posted in LinuxLeave a comment

Leidsin lõpuks command line FTP kliendi – lftp

Posted on October 8, 2010 - July 8, 2011 by margusja

Olen aastaid kasutanud command line FTP kliendina ncfpt nimelist tooli koos sellega kaasnevate hädadega. Lõpuks sai isu täis ja sukeldusin internetiavarustesse parema ja minu vajadusi rahuldavat tööriista.
Selgus, et lahendus on olnud enamus aega kõigis minu kasutada olnud serverites – lftp.
Paari reaga enda jaoks siis nn. näidissessioon.

Download:

ibrahim@anfield:~$ mkdir dnld ; cd dnld
ibrahim@anfield:~/dnld$ lftp ftp://ftpsite.com/
set ftp:ssl-force true # Juhul kui on vajadus SFTP järele.

lftp ftpsite.com:~> user username
Password:
lftp ftpsite.com:~> cd /directory/to/download/
lftp ftpsite.com:~/directory/to/download/> mirror .

Upload:

ibrahim@anfield:~$ cd upld
ibrahim@anfield:~/upld$ lftp ftp://ftpsite.com/
lftp ftpsite.com:~> user username
Password:
lftp ftpsite.com:~> cd /directory/to/upload/
lftp ftpsite.com:~/directory/to/upload/> mirror -R .

Use ssl

[09:47:17 margusja@arendus cms]$ lftp
lftp :~> set ftp:ssl-force true
lftp :~> connect server.domain.ee
lftp server.domain.ee:~> user username
Password:

Posted in LinuxLeave a comment

PHP Getters Setters

Posted on August 10, 2010 - August 10, 2010 by margusja


class Test {

// Set a private property. You can't get is directly
private $data = array();

// get a property
public function __get($name) {
return $this->data[$name];
}

// set a property
public function __set($name, $value) {
$this->data[$name] = $value;
}
}

// create object
$test = new Test;

// first property
$test->firstName = "Margus";
echo "Firstname = ".$test->firstName;

// second property
$test->lastName = "Roo";
echo "Lastname = ".$test->lastName;

Tulemus:

Firstname = Margus

Lastname = Roo

Posted in LinuxLeave a comment

linux – php – oracle OCI

Posted on July 29, 2010 by margusja

Oli tarvis php-le OCI tuge.

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html lehelt on vaja kaks pakki.

oracle-instantclient11.2-basic ning oracle-instantclient11.2-devel. Mina võtsin RPM-id mis istusid kenasti FC-10 peale.

library-d sattusid siia: /usr/lib/oracle/[VERSION]/client/lib/

siin ma tegin general symlingid:

ln -s libclntsh.so.11.1 libclntsh.so

ln -s libocci.so.11.1 libocci.so

Siis tirisin http://pecl.php.net/get/oci8-1.4.1.tgz (ilmselt tulevikus versioon muutub)

Pakkisin lahti ning läksin lahtipakitud kataloogi

./configure –with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib/  (11.2 on siis versioon minujuures. Tulevikus võib muutuda)

make

sudo make install


Libraries have been installed in:
/home/margusja/oci8-1.4.1/modulesIf you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions: /usr/lib/php/modules/
>

Lisame php.ini-s rea: extension=oci8.so

apachele restart


[14:48:37 root@arendus ~]# php -i | grep oci
oci8
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20

Posted in LinuxLeave a comment

Linux, protsessid ja mälu

Posted on July 21, 2010 by margusja

ps aux – leiad protsessid edasi uuri täpsemalt protsess

pmap -x [pid] või cat /proc/[pid]/smaps

Posted in LinuxLeave a comment

BP kohvireostust likvideerimas

Posted on July 2, 2010 - July 2, 2010 by margusja

[kml_flashembed movie="http://www.youtube.com/v/2AAa0gd7ClM" width="425" height="344" allowfullscreen="true" fvars="fs=1" /]

Posted in Fun, LinuxLeave a comment

selenium-rc

Posted on May 27, 2010 by margusja

Testin kas selenium-rc server toimib. Enne sisenen serverisse ssh serverinimi -X ehk siis X over ssh.


[22:40:50 margusja@arendus ~]$ java -jar /usr/local/bin/selenium-server.jar -interactive
22:42:00.790 INFO - Java: Sun Microsystems Inc. 1.6.0_0-b12
22:42:00.791 INFO - OS: Linux 2.6.27.38-170.2.113.fc10.i686 i386
22:42:00.798 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
22:42:00.864 INFO - Version Jetty/5.1.x
22:42:00.865 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
22:42:00.866 INFO - Started HttpContext[/selenium-server,/selenium-server]
22:42:00.866 INFO - Started HttpContext[/,/]
22:42:00.871 INFO - Started SocketListener on 0.0.0.0:4444
22:42:00.872 INFO - Started org.mortbay.jetty.Server@6e70c7
Entering interactive mode... type Selenium commands here (e.g: cmd=open&1=http://www.yahoo.com)
cmd=open&1=http://margusja.pri.ee
22:42:28.559 INFO - ---> Requesting http://localhost:4444/selenium-server/driver?cmd=open&1=http://margusja.pri.ee&sessionId=
22:42:28.765 INFO - Checking Resource aliases
22:42:28.771 INFO - Command request: open[http://margusja.pri.ee, ] on session
22:42:28.780 ERROR - Exception running 'open 'command on session
java.lang.RuntimeException: sessionId doesn't exist; perhaps this session was already stopped?
at org.openqa.selenium.server.FrameGroupCommandQueueSet.getQueueSet(FrameGroupCommandQueueSet.java:218)
at org.openqa.selenium.server.commands.SeleniumCoreCommand.execute(SeleniumCoreCommand.java:34)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:549)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:364)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:125)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
22:42:28.781 INFO - Got result: ERROR Server Exception: sessionId doesn't exist; perhaps this session was already stopped? on session
cmd=getNewBrowserSession&1=*firefox&2=http://margusja.pri.ee
22:43:22.731 INFO - ---> Requesting http://localhost:4444/selenium-server/driver?cmd=getNewBrowserSession&1=*firefox&2=http://margusja.pri.ee
22:43:22.736 INFO - Command request: getNewBrowserSession[*firefox, http://margusja.pri.ee] on session null
22:43:22.738 INFO - creating new remote session
22:43:22.933 INFO - Allocated session ef946e17e9634c00b94683cf65c81dd8 for http://margusja.pri.ee, launching...
22:43:23.023 INFO - Preparing Firefox profile...
Xlib: extension "RANDR" missing on display "localhost:11.0".
Xlib: extension "RANDR" missing on display "localhost:11.0".
22:43:54.433 INFO - Launching Firefox...
22:44:47.477 INFO - Got result: OK,ef946e17e9634c00b94683cf65c81dd8 on session ef946e17e9634c00b94683cf65c81dd8
^C22:47:08.004 INFO - Shutting down...
22:47:08.065 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]

Posted in LinuxLeave a comment

apache suexec mod_fcgi

Posted on May 19, 2010 by margusja

Juhtus selline asi, et ühe virtualhosti seadistamisel annab error 500 ning logis:

[Wed May 19 11:11:39 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed May 19 11:11:39 2010] [error] [client 192.168.0.177] Premature end of script headers: test.php

Ja noh ei saa aru mis viga on.
Lõpuks selgus, et virtuali cgi-bin ning seal asuv wrapper peavad olema 755 õigustes.

Posted in LinuxLeave a comment

Posts navigation

Older posts
Newer posts

The Master

Categories

  • Apache
  • Apple
  • Assembler
  • Audi
  • BigData
  • BMW
  • C
  • Elektroonika
  • Fun
  • Hadoop
  • help
  • Infotehnoloogia koolis
  • IOT
  • IT
  • IT eetilised
  • Java
  • Langevarjundus
  • Lapsed
  • lastekodu
  • Linux
  • M-401
  • Mac
  • Machine Learning
  • Matemaatika
  • Math
  • MSP430
  • Muusika
  • neo4j
  • openCL
  • Õpetaja identiteet ja tegevusvõimekus
  • oracle
  • PHP
  • PostgreSql
  • ProM
  • R
  • Turvalisus
  • Varia
  • Windows
Proudly powered by WordPress | Theme: micro, developed by DevriX.