Wednesday, June 1, 2016

install oracle client on ubuntu 64

1: download oracle packages
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

2, install:
 alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
 alien -i oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
 alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

3: install libaio1
  apt-get install libaio1

4:

export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

5: test:
sqlplus64 anacs/tkat@//analycsjus-west-2.rds.amazonaws.com:1521/IX


SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 1 22:34:01 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Wed Jun 01 2016 22:33:40 +00:00

Connected to:
Oracle Database 12c Release 12.1.0.1.0 - 64bit Production

SQL>

Saturday, December 5, 2015

node.js app enable cors





app.configure(function(){
  app.use(app.router);
  // the following middlewares are only necessary for the mounted 'dashboard' app,
  // but express needs it on the parent app (?) and it therefore pollutes the api
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser('Z5V45V6B5U56B7J5N67J5VTH345GC4G5V4'));
  app.use(express.cookieSession({
    key:    'uptime',
    secret: 'FZ5HEE5YHD3E566756234C45BY4DSFZ4',
    proxy:  true,
    cookie: { maxAge: 60 * 60 * 1000 }
  }));
  app.use(function (req, res, next) {
    // Website you wish to allow to connect
    res.setHeader('Access-Control-Allow-Origin', '*');
    // Request methods you wish to allow
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    // Request headers you wish to allow
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
    // Set to true if you need the website to include cookies in the requests sent
    // to the API (e.g. in case you use sessions)
    res.setHeader('Access-Control-Allow-Credentials', true);
    // Pass to next layer of middleware
    next();
  });
  app.set('pollerCollection', new PollerCollection());
});

Wednesday, November 25, 2015

systemctl daemon-reload

  562  systemctl status elasticsearch.service
  563  systemctl daemon-reload
  564  systemctl status elasticsearch.service
  565  vim  /etc/systemd/system/multi-user.target.wants/elasticsearch.service
  566  systemctl daemon-reload
  567  systemctl status elasticsearch.service
  568  service  elasticsearch start
  569  history
  570  systemctl disable elasticsearch
  571  systemctl enable elasticsearch
  572  systemctl status elasticsearch.service
  573  less /usr/lib/systemd/system/elasticsearch.service
  574  vim  /etc/systemd/system/multi-user.target.wants/elasticsearch.service
  575  vim /etc/init.d/elasticsearch
  576  systemctl status elasticsearch.service
  577  systemctl daemon-reload
  578  systemctl status elasticsearch.service
  579  vim /etc/init.d/elasticsearch
  580  systemctl status elasticsearch.service
  581  systemctl daemon-reload
  582  systemctl status elasticsearch.service
  583  history
  584  systemctl disable elasticsearch
  585  systemctl enable elasticsearch
  586  systemctl status elasticsearch.service
  587  ps -ef | grep el
  588  service  elasticsearch start
  589  service  elasticsearch status
  590  ps -ef | grep el

Monday, November 16, 2015

hadoop 2.7.1 single node cluster

root@hadoop-master:/myhadoop# export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
root@hadoop-master:/myhadoop# export HADOOP\_PREFIX=/myhadoop/hadoop-2.7.1
root@hadoop-master:/myhadoop# export HADOOP_CONF_DIR=$HADOOP_PREFIX/etc/hadoop

root@hadoop-master:~# vim /myhadoop/hadoop-2.7.1/etc/hadoop/hadoop-env.sh

#export JAVA_HOME=${JAVA_HOME}

export JAVA_HOME=/usr/lib/jvm/java-8-oracle/

If you want to change it globally and at system level;

root@hadoop-master:~# vim /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/

Thursday, November 12, 2015

hadoop on ubunte with java 8

1, install java 8
 sudo add-apt-repository ppa:webupd8team/java
 sudo apt-get update
 sudo apt-get install oracle-java8-installer

2, export java
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/

3, download hadoop
wget http://apache.arvixe.com/hadoop/common/stable/hadoop-2.7.1.tar.gz

4, copy xml file
cp hadoop-2.7.1/etc/hadoop/*.xml input/

5, run hadoop
hadoop-2.7.1/bin/hadoop jar hadoop-2.7.1/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.jar grep input output 'dfs[a-z.]+'



Wednesday, September 23, 2015

docket rabbitmq

root@sam-clm2:~# docker exec 7931dc7e8611 /usr/sbin/rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@ms-rabbit... started 6 plugins.
root@sam-clm2:~#


  wget http://guest:guest@localhost:15672/cli/rabbitmqadmin
  mv rabbitmqadmin.2 /usr/local/bin/rabbitmqadmin
  chmod +x /usr/local/bin/rabbitmqadmin
  rabbitmqadmin list exchanges

root@sam-clm2:~# rabbitmqadmin declare exchange name=exchange_Office type=direct
exchange declared
root@sam-clm2:~# rabbitmqadmin declare exchange name=exchange_PE type=direct
exchange declared
root@sam-clm2:~# rabbitmqadmin declare exchange name=exchange_JS type=direct
exchange declared
root@sam-clm2:~# rabbitmqadmin declare exchange name=exchange_ALL type=direct
exchange declared
root@sam-clm2:~# rabbitmqadmin declare exchange name=exchange_PDF type=direct




root@sam-clm2:~# docker exec 7931dc7e8611 /usr/sbin/rabbitmq-plugins list
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status:   * = running on rabbit@ms-rabbit
 |/
[e*] amqp_client                       3.5.4
[  ] cowboy                            0.5.0-rmq3.5.4-git4b93c2d
[e*] mochiweb                          2.7.0-rmq3.5.4-git680dba8
[  ] rabbitmq_amqp1_0                  3.5.4
[  ] rabbitmq_auth_backend_ldap        3.5.4
[  ] rabbitmq_auth_mechanism_ssl       3.5.4
[  ] rabbitmq_consistent_hash_exchange 3.5.4
[  ] rabbitmq_federation               3.5.4
[  ] rabbitmq_federation_management    3.5.4
[E*] rabbitmq_management               3.5.4
[e*] rabbitmq_management_agent         3.5.4
[  ] rabbitmq_management_visualiser    3.5.4
[  ] rabbitmq_mqtt                     3.5.4
[  ] rabbitmq_shovel                   3.5.4
[  ] rabbitmq_shovel_management        3.5.4
[  ] rabbitmq_stomp                    3.5.4
[  ] rabbitmq_test                     3.5.4
[  ] rabbitmq_tracing                  3.5.4
[e*] rabbitmq_web_dispatch             3.5.4
[  ] rabbitmq_web_stomp                3.5.4
[  ] rabbitmq_web_stomp_examples       3.5.4
[  ] sockjs                            0.3.4-rmq3.5.4-git3132eb9
[e*] webmachine                        1.10.3-rmq3.5.4-gite9359c7

ang@sam-clm2:~$ rabbitmqadmin list exchanges
+--------------------+---------+
|        name        |  type   |
+--------------------+---------+
|                    | direct  |
| amq.direct         | direct  |
| amq.fanout         | fanout  |
| amq.headers        | headers |
| amq.match          | headers |
| amq.rabbitmq.log   | topic   |
| amq.rabbitmq.trace | topic   |
| amq.topic          | topic   |
| exchange_ALL       | direct  |
| exchange_JS        | direct  |
| exchange_Office    | direct  |
| exchange_PDF       | direct  |
| exchange_PE        | direct  |
+--------------------+---------+

ang@sam-clm2:~$ rabbitmqadmin list queues
+------------------+----------+
|       name       | messages |
+------------------+----------+
| queue_ALL_new    | 0        |
| queue_JS_new     | 0        |
| queue_Office_new | 0        |
| queue_PDF_new    | 0        |
| queue_PE_new     | 0        |
+------------------+----------+


install rabbit-mq in ubuntu

1, vim /etc/apt/sources.list

Add the following line to your /etc/apt/sources.list:
deb http://www.rabbitmq.com/debian/ testing main


 2,    wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
 

3,  apt-key add rabbitmq-signing-key-public.asc

4,    apt-get update

5,  apt-get install rabbitmq-server
 
6,  apt-get -f install


  61  rabbitmqadmin list exchanges
   62  rabbitmqadmin list exchanges -u guest -p guest
   63  rabbitmq-plugins list
   64  rabbitmq-plugins enable rabbitmq_management
   65  rabbitmq-plugins list
   66  rabbitmqadmin list exchanges -u guest -p guest
   67  rabbitmqadmin list exchanges
   68  rabbitmqadmin list queues
   69  history