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

Drupal7 services REST request examples

Posted on May 24, 2011 by margusja

List users

[Tue May 24 17:59:59 margusja@IRack curl -v http://hostname/drupal/rest_test/user/
* About to connect() to hostname port 80 (#0)
* Trying 192.168.0.11... connected
* Connected to hostname (192.168.0.11) port 80 (#0)
> GET /drupal/rest_test/user/ HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: hostname
> Accept: */*
>
< HTTP/1.1 200 OK < Date: Tue, 24 May 2011 15:00:06 GMT < Server: Apache/2.2.14 (Fedora) < X-Powered-By: PHP/5.2.9 < Expires: Sun, 19 Nov 1978 05:00:00 GMT < Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0 < ETag: "1306249206" < Vary: Accept < Last-Modified: Tue, 24 May 2011 15:00:06 GMT < Connection: close < Transfer-Encoding: chunked < Content-Type: text/yaml < --- - uid: 1 name: margusja pass: $S$CLdHKPLTL5C9RJC/aduBDDD2flz8nMh96EByixXh.os3ebjxxxx mail: margusja@okia.ee theme: signature: signature_format: created: 1304930237 access: 1306247932 login: 1306247601 status: 1 timezone: language: picture: 0 init: margusja@okia.ee data: uri: http://hostname/drupal/rest_test/user/1 - uid: 0 name: pass: mail: theme: signature: signature_format: created: 0 access: 0 login: 0 status: 0 timezone: language: picture: 0 init: data: uri: http://hostname/drupal/rest_test/user/0 * Closing connection #0 [Tue May 24 18:00:07 margusja@IRack

list user 1

[Tue May 24 18:00:07 margusja@IRack curl -v http://hostname/drupal/rest_test/user/1
* About to connect() to hostname port 80 (#0)
* Trying 192.168.0.11... connected
* Connected to hostname (192.168.0.11) port 80 (#0)
> GET /drupal/rest_test/user/1 HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: hostname
> Accept: */*
>
< HTTP/1.1 200 OK < Date: Tue, 24 May 2011 15:02:08 GMT < Server: Apache/2.2.14 (Fedora) < X-Powered-By: PHP/5.2.9 < Expires: Sun, 19 Nov 1978 05:00:00 GMT < Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0 < ETag: "1306249328" < Vary: Accept < Last-Modified: Tue, 24 May 2011 15:02:08 GMT < Connection: close < Transfer-Encoding: chunked < Content-Type: text/yaml < --- uid: 1 name: margusja pass: $S$CLdHKPLTL5C9RJC/aduBDDD2flz8nMh96EByixXh.os3ebj9xxxx mail: margusja@okia.ee theme: signature: signature_format: created: 1304930237 access: 1306247932 login: 1306247601 status: 1 timezone: language: picture: init: margusja@okia.ee data: false roles: 2: authenticated user 3: administrator rdf_mapping: rdftype: - sioc:UserAccount name: predicates: - foaf:name homepage: predicates: - foaf:page type: rel * Closing connection #0 [Tue May 24 18:02:08 margusja@IRack

Create a new user

[Tue May 24 18:02:08 margusja@IRack curl -v --curl -v --data "account[name]=test&account[mail]=test@test.com&account[pass]=pass" http://hostname/drupal/rest_test/user/
* About to connect() to hostname port 80 (#0)
* Trying 192.168.0.11... connected
* Connected to hostname (192.168.0.11) port 80 (#0)
> POST /drupal/rest_test/user/ HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: hostname
> Accept: */*
> Content-Length: 65
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK < Date: Tue, 24 May 2011 15:04:03 GMT < Server: Apache/2.2.14 (Fedora) < X-Powered-By: PHP/5.2.9 < Expires: Sun, 19 Nov 1978 05:00:00 GMT < Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0 < ETag: "1306249443" < Vary: Accept < Last-Modified: Tue, 24 May 2011 15:04:03 GMT < Connection: close < Transfer-Encoding: chunked < Content-Type: text/yaml < --- uid: 5 uri: http://hostname/drupal/rest_test/user/5 * Closing connection #0 [Tue May 24 18:04:04 margusja@IRack

Delete a user

[Tue May 24 18:04:04 margusja@IRack curl -v --data "X DELETE -v http://hostname/drupal/rest_test/user/5
* About to connect() to hostname port 80 (#0)
* Trying 192.168.0.11... connected
* Connected to hostname (192.168.0.11) port 80 (#0)
> DELETE /drupal/rest_test/user/5 HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: hostname
> Accept: */*
>
< HTTP/1.1 200 OK < Date: Tue, 24 May 2011 15:05:26 GMT < Server: Apache/2.2.14 (Fedora) < X-Powered-By: PHP/5.2.9 < Expires: Sun, 19 Nov 1978 05:00:00 GMT < Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0 < ETag: "1306249526" < Vary: Accept < Last-Modified: Tue, 24 May 2011 15:05:26 GMT < Connection: close < Transfer-Encoding: chunked < Content-Type: text/yaml < --- - true * Closing connection #0 [Tue May 24 18:05:26 margusja@IRack

Posted in LinuxLeave a comment

CentOS 5.6 Linux 2.6.18-238.9.1.el5xen xen.x86_64 3.0.3-120.el5_6.1

Posted on April 30, 2011 - May 4, 2011 by margusja

CentOS 5.6 Linux 2.6.18-238.9.1.el5xen xen.x86_64 3.0.3-120.el5_6.1 xen-3.0.3

during boot:


ib_srp: ASYNC event= 17 on device= mlx4_0
ib_srp: ASYNC event= 11 on device= mlx4_0
ib_srp: ASYNC event= 9 on device= mlx4_0
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P001._PPC] (Node ffff880001d89fd0), AE_NOT_FOUND
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P002._PPC] (Node ffff880001d89f10), AE_NOT_FOUND
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P003._PPC] (Node ffff880001d89e50), AE_NOT_FOUND
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P004._PPC] (Node ffff880001d89d90), AE_NOT_FOUND
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P005._PPC] (Node ffff880001d89cd0), AE_NOT_FOUND
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P006._PPC] (Node ffff880001d89c10), AE_NOT_FOUND
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P007._PPC] (Node ffff8801db6b4950), AE_NOT_FOUND
ACPI Error (psargs-0355): [PSTE] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed [\_PR_.P008._PPC] (Node ffff8801db6b4890), AE_NOT_FOUND
iser: iser_connect:connecting to: ffff8801db9fa04cI4, port 0xbc0c
iser: iser_cma_handler:event 0 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_cma_handler:event 2 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_create_ib_conn_res:setting conn ffff8801d31f8110 cma_id ffff88000e650800: fmr_pool ffff8801d3264c40 qp ffff8801db694600
iser: iser_cma_handler:event 8 status 10 conn ffff8801d31f8110 id ffff88000e650800
iser: iscsi_iser_ep_poll:ib conn ffff8801d31f8110 rc = -1
iser: iscsi_iser_ep_disconnect:ib conn ffff8801d31f8110 state 4
iser: iser_free_ib_conn_res:freeing conn ffff8801d31f8110 cma_id ffff88000e650800 fmr pool ffff8801d3264c40 qp ffff8801db694600
iser: iser_device_try_release:device ffff8801d3f79a80 refcount 0
iser: iser_connect:connecting to: ffff8801d4c63e4cI4, port 0xbc0c
iser: iser_cma_handler:event 0 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_cma_handler:event 2 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_create_ib_conn_res:setting conn ffff8801d31f8110 cma_id ffff88000e650800: fmr_pool ffff8801ccec9dc0 qp ffff8801db694600
iser: iser_cma_handler:event 8 status 10 conn ffff8801d31f8110 id ffff88000e650800
iser: iscsi_iser_ep_poll:ib conn ffff8801d31f8110 rc = -1
iser: iscsi_iser_ep_disconnect:ib conn ffff8801d31f8110 state 4
iser: iser_free_ib_conn_res:freeing conn ffff8801d31f8110 cma_id ffff88000e650800 fmr pool ffff8801ccec9dc0 qp ffff8801db694600
iser: iser_device_try_release:device ffff8801d3f79a80 refcount 0
iser: iser_connect:connecting to: ffff8801d4c63e4cI4, port 0xbc0c
iser: iser_cma_handler:event 0 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_cma_handler:event 2 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_create_ib_conn_res:setting conn ffff8801d31f8110 cma_id ffff88000e650800: fmr_pool ffff8801d744a540 qp ffff8801d4c63000
iser: iser_cma_handler:event 8 status 10 conn ffff8801d31f8110 id ffff88000e650800
iser: iscsi_iser_ep_poll:ib conn ffff8801d31f8110 rc = -1
iser: iscsi_iser_ep_disconnect:ib conn ffff8801d31f8110 state 4
iser: iser_free_ib_conn_res:freeing conn ffff8801d31f8110 cma_id ffff88000e650800 fmr pool ffff8801d744a540 qp ffff8801d4c63000
iser: iser_device_try_release:device ffff8801d3f79a80 refcount 0
iser: iser_connect:connecting to: ffff8801db69464cI4, port 0xbc0c
iser: iser_cma_handler:event 0 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_cma_handler:event 2 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_create_ib_conn_res:setting conn ffff8801d31f8110 cma_id ffff88000e650800: fmr_pool ffff8801ccec9640 qp ffff8801d4c63000
iser: iser_cma_handler:event 8 status 10 conn ffff8801d31f8110 id ffff88000e650800
iser: iscsi_iser_ep_poll:ib conn ffff8801d31f8110 rc = -1
iser: iscsi_iser_ep_disconnect:ib conn ffff8801d31f8110 state 4
iser: iser_free_ib_conn_res:freeing conn ffff8801d31f8110 cma_id ffff88000e650800 fmr pool ffff8801ccec9640 qp ffff8801d4c63000
iser: iser_device_try_release:device ffff8801d3f79a80 refcount 0
iser: iser_connect:connecting to: ffff8801db69464cI4, port 0xbc0c
iser: iser_cma_handler:event 0 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_cma_handler:event 2 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_create_ib_conn_res:setting conn ffff8801d31f8110 cma_id ffff88000e650800: fmr_pool ffff8801cd39fec0 qp ffff8801d4c63000
iser: iser_cma_handler:event 8 status 10 conn ffff8801d31f8110 id ffff88000e650800
iser: iscsi_iser_ep_poll:ib conn ffff8801d31f8110 rc = -1
iser: iscsi_iser_ep_disconnect:ib conn ffff8801d31f8110 state 4
iser: iser_free_ib_conn_res:freeing conn ffff8801d31f8110 cma_id ffff88000e650800 fmr pool ffff8801cd39fec0 qp ffff8801d4c63000
iser: iser_device_try_release:device ffff8801d3f79a80 refcount 0
iser: iser_connect:connecting to: ffff8801db69464cI4, port 0xbc0c
iser: iser_cma_handler:event 0 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_cma_handler:event 2 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_create_ib_conn_res:setting conn ffff8801d31f8110 cma_id ffff88000e650800: fmr_pool ffff8801d744a540 qp ffff8801d4c63000
iser: iser_cma_handler:event 8 status 10 conn ffff8801d31f8110 id ffff88000e650800
iser: iscsi_iser_ep_poll:ib conn ffff8801d31f8110 rc = -1
iser: iscsi_iser_ep_disconnect:ib conn ffff8801d31f8110 state 4
iser: iser_free_ib_conn_res:freeing conn ffff8801d31f8110 cma_id ffff88000e650800 fmr pool ffff8801d744a540 qp ffff8801d4c63000
iser: iser_device_try_release:device ffff8801d3f79a80 refcount 0
iser: iser_connect:connecting to: ffff8801db69464cI4, port 0xbc0c
iser: iser_cma_handler:event 0 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_cma_handler:event 2 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iser_create_ib_conn_res:setting conn ffff8801d31f8110 cma_id ffff88000e650800: fmr_pool ffff8801ccec9640 qp ffff8801d4c63000
iser: iser_cma_handler:event 9 status 0 conn ffff8801d31f8110 id ffff88000e650800
iser: iscsi_iser_ep_poll:ib conn ffff8801d31f8110 rc = 1
scsi4 : iSCSI Initiator over iSER, v.0.1
iser: iscsi_iser_conn_bind:binding iscsi/iser conn ffff8801da550a90 ffff8801da550ce8 to ib_conn ffff8801d31f8110
Vendor: IET Model: Controller Rev: 0001
Type: RAID ANSI SCSI revision: 05
scsi 4:0:0:0: Attached scsi generic sg2 type 12
Vendor: IET Model: VIRTUAL-DISK Rev: 0001
Type: Direct-Access ANSI SCSI revision: 05
SCSI device sdc: 20971520 512-byte hdwr sectors (10737 MB)
sdc: Write Protect is off
sdc: Mode Sense: 49 00 00 08
SCSI device sdc: drive cache: write back
SCSI device sdc: 20971520 512-byte hdwr sectors (10737 MB)
sdc: Write Protect is off
sdc: Mode Sense: 49 00 00 08
SCSI device sdc: drive cache: write back
sdc: sdc1 sdc2
sd 4:0:0:1: Attached scsi disk sdc
sd 4:0:0:1: Attached scsi generic sg3 type 0
Vendor: IET Model: VIRTUAL-DISK Rev: 0001
Type: Direct-Access ANSI SCSI revision: 05
SCSI device sdd: 1048576000 512-byte hdwr sectors (536871 MB)
sdd: Write Protect is off
sdd: Mode Sense: 49 00 00 08
SCSI device sdd: drive cache: write back
SCSI device sdd: 1048576000 512-byte hdwr sectors (536871 MB)
sdd: Write Protect is off
sdd: Mode Sense: 49 00 00 08
SCSI device sdd: drive cache: write back
sdd: sdd1 sdd2 sdd3 sdd4 < sdd5 >
sd 4:0:0:2: Attached scsi disk sdd
sd 4:0:0:2: Attached scsi generic sg4 type 0

 

Solution – Build a new kernel 2.6.32.39 with dom0 support. Build a new xen-xen.x86_64-4.1.0-120

Posted in Linux1 Comment

centos infiniband 40 Gb/sec (4X QDR) iscsi iser transport speed test

Posted on April 13, 2011 - May 4, 2011 by margusja

/dev/sda – is a local device

[root@localhost ~]# hdparm -Tt /dev/sda

/dev/sda:

Timing cached reads: 23764 MB in 1.99 seconds = 11956.21 MB/sec

Timing buffered disk reads: 248 MB in 3.01 seconds = 82.52 MB/sec

Benchmarking /dev/sda [976773168 blocks, 500107862016 bytes, 465 GB, 476940 MB, 500 GiB, 500107 MiB]
[512 logical sector size, 512 physical sector size]
[1 threads]
Wait 30 seconds…………………………
Results: 74 seeks/second, 13.447 ms random access time (209836842 < offsets < 500103026710)

—

/dev/sdb – is attached over icasi + iser transport

Võtame targeti külge kasutades hariliku TCP protokolli over ISCSI

[root@localhost network-scripts]# iscsiadm -m node -p 192.168.10.2 -T iqn.2011-04.ee.okia:storage1 –login

Testime kettapöördumist

[root@localhost network-scripts]# hdparm -Tt /dev/sdd

/dev/sdd:

Timing cached reads: 22224 MB in 1.99 seconds = 11182.37 MB/sec

Timing buffered disk reads: 250 MB in 3.01 seconds = 83.16 MB/sec

—

Nüüd võtame targeti külge kasutades iser protokolli over ISCSI

[root@localhost network-scripts]# iscsiadm -m node -p 192.168.10.2 -T iqn.2011-04.ee.okia:storage1 –op update -n node.transport_name -v iser

Testime kiirust

[[root@localhost network-scripts]# hdparm -Tt /dev/sdd

/dev/sdd:

Timing cached reads: 22020 MB in 1.99 seconds = 11079.28 MB/sec

Timing buffered disk reads: 610 MB in 3.01 seconds = 202.83 MB/sec

Benchmarking /dev/sdd [1048576000 blocks, 536870912000 bytes, 500 GB, 512000 MB, 536 GiB, 536870 MiB] [512 logical sector size, 512 physical sector size] [1 threads] Wait 30 seconds………………………… Results: 151 seeks/second, 6.609 ms random access time (148654250 < offsets < 536801383750) [root@xen1 ~]#

Posted in LinuxLeave a comment

linux command line date to timestamp

Posted on March 31, 2011 - March 31, 2011 by margusja

[Thu Mar 31 09:51:50 margusja@IRack date -j -f “%Y-%m-%d %H:%M:%S” “2011-03-31 23:59:59” “+%s”

Posted in LinuxLeave a comment

Convert latin1 to UTF-8 in MySQL

Posted on March 15, 2011 - March 15, 2011 by margusja

mysqldump -u root -p –default-character-set=latin1 -c –insert-ignore –skip-set-charset -r dump.sql latin1_dbname
file dump.sql
Non-ISO extended-ASCII HTML document text, with very long lines
iconv -f ISO8859-1 -t UTF-8 dump.sql > dump_utf8.sql
file dump_utf8.sql
UTF-8 Unicode HTML document text, with very long lines
perl -pi -w -e ‘s/CHARSET=latin1/CHARSET=utf8/g;’ dump_utf8.sql
mysqladmin -u user -p –default-character-set=utf8 create utf8_dbname; või mysql käsurealt: CREATE DATABASE `utf8_dbname` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql -u user –max_allowed_packet=16M -p –default-character-set=utf8 utf8dbname < dump_utf8.sql

Posted in LinuxLeave a comment

Icecast stress test

Posted on March 11, 2011 - March 11, 2011 by margusja

Tükk aega mõtelesin, millega arendatavat icecast serverit testida. Leidsin streamripper nimelist tööriista.

Mul on 7-me kanaliga icecast server.


#!/bin/sh

URL=http://server:8000/channel.m3u
for i in 1 2 3 4 5 6 7 8 9 10
do
streamripper $URL -r &
sleep 5
done

 

 

Järgmine kord teen väikese skripti ka.

Posted in IT, LinuxLeave a comment

Keemia põhitõed

Posted on March 7, 2011 - March 28, 2011 by margusja

Molaarmassi arvutamine
index X elemendi aatomimass + element n

Näiteks M(H2O) e H2O molaarmass on 2×1+16=18g/mol

Õhu molaarmass 29g/mol

 

F                                                H                     F                                                H
I                                                  I                      I                                                  I
F – B(elektrofiil) + (nukleofiil) N – H <-> F-B (elektrofiil) – (nukleofiil) N-H  ehk siin on näha põhjus, miks BF(3)+NH(3)
I                                                  I                      I                                                  I
F                                                 H                    F                                                H

Posted in LinuxLeave a comment

How to create huge CPU load e kuidas tekitada suurt CPU koormust

Posted on February 23, 2011 - May 12, 2011 by margusja


md5sum < /dev/urandom


openssl speed

Posted in LinuxLeave a comment

Kuidas kopeerida root kasutaja all nii, et originaal failiõigused jääks alles kasutades tar käsku

Posted on February 22, 2011 by margusja

tar cf – * | ( cd /target; tar xfp -)

Posted in LinuxLeave a comment

curl and how to test web page header

Posted on February 22, 2011 by margusja


[Tue Feb 22 11:11:27 margusja@IRack curl -I margus.roo.ee
HTTP/1.1 200 OK
Date: Tue, 22 Feb 2011 09:20:45 GMT
Server: Apache/2
X-Powered-By: PHP/5.2.14
X-Pingback: http://margus.roo.ee/xmlrpc.php
Vary: Accept-Encoding,User-Agent
Content-Type: text/html; charset=UTF-8

[Tue Feb 22 11:11:35 margusja@IRack

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.