Skip to main content

Posts

Getting Started with Flask

In this post, I will give you a very basic example to run a hello world program in flask. What make it different with the other tutorial is that this will enable your program to run from a cloud server, not just on a local server. Before we go further Because you want to run it in a cloud server, most probably you will use your ssh to connect and run it. However, you need to know that when you end your ssh session, your Flask server will also be shut down. To prevent that, my favourite is to use screen . If you are ubuntu lover like me, you can install it by typing $ sudo apt-get install -y screen Before you do any work, start by typing $ screen It will open a session for you. Later, after you run your Flask server, you may want to detach the session using this command ctrl-a d If you later want to go back to your session, you can do it by using the following command $ screen -r OK, without further ado, this is your first hello world program in Fl...

Some useful SSH Commands

Install SSH Server in Ubuntu sudo apt-get install openssh-server Run SSH Server sudo service ssh restart The output will be like * Restarting OpenBSD Secure Shell server sshd [ OK ] Check SSH Status ps -ef |grep "sshd" The output will be like hduser@d1:/hadoopSetup$ ps -ef | grep "sshd" root 125 0 0 02:35 ? 00:00:00 /usr/sbin/sshd hduser 138 79 0 02:45 pts/2 00:00:00 grep --color=auto sshd

Tips for cheap overnight car parking for your flight from KLIA or KLIA2

If you want to travel from KLIA or KLIA2, the parking fee for overnight parking in the airport is just crazy. In KLIA2, the first night will be 42 MYR. After that, it will be reduced to 21 MYR. Even after reduced, the fee is still very very very very very expensive. I will prefer to spend the money to buy some foods. 21 MYR equals to two or three times meals. Hahaha OK. So where you should put your car when you travel from KLIA or KLIA? I found some answers, but for myself, I prefer to park my car at Salak Tinggi Station. In Google Maps, you can find the coordinate from this link: https://goo.gl/maps/WWSdj2ZiTN22 Previously it was so cheap to park in Salak Tinggi. Only 3 MYR per night. However, now they increase the fee to 3 MYR for parking during the day and 8 MYR for overnight parking. However, 8 MYR is not that much compared to 21 MYR. Right? OK. So after parking the car, how can we go to KLIA or KLIA2? The first KLIA Transit train from KL-Sentral to KLIA2 st...

Check Status of Running Nodes in Hadoop

To see if nodes in your Hadoop cluster connected and run, followings are the ways to see JPS Command Run jps command in master node and slave nodes. In master node, the output of the jps should be something like this $ jps 1634 JobHistoryServer 692 NameNode 2471 Jps 1191 ResourceManager 841 DataNode 1023 SecondaryNameNode 1311 NodeManager When you run jps in slave, the output should be something like this $ jps 528 Jps 292 NodeManager 170 DataNode hdfs dfsadmin -report This is a very nice tool to see the statistic of each nodes in your Hadoop cluster. When you run the command, you will get ouput something like $ hdfs dfsadmin -report Configured Capacity: 82999410688 (77.30 GB) Present Capacity: 59326111744 (55.25 GB) DFS Remaining: 59325284352 (55.25 GB) DFS Used: 827392 (808 KB) DFS Used%: 0.00% Under replicated blocks: 0 Blocks with corrupt replicas: 0 Missing blocks: 0 Missing blocks (with replication factor 1): 0 Pending deletion blocks: 0 ...

Mininet/Containernet Problem: Exception: Error creating interface pair (s2-eth5,s3-eth1): RTNETLINK answers: File exists

If you did not shut down the previous running mininet/containernet network (e.g. if you lose your connection to remote server), you will got the following error when you try to rerun your mininet network Traceback (most recent call last): File "./mynet.py", line 31, in <module> net.addLink(d2, s1) File "build/bdist.linux-x86_64/egg/mininet/net.py", line 403, in addLink File "build/bdist.linux-x86_64/egg/mininet/link.py", line 430, in __init__ File "build/bdist.linux-x86_64/egg/mininet/link.py", line 474, in makeIntfPair File "build/bdist.linux-x86_64/egg/mininet/util.py", line 202, in makeIntfPair Exception: Error creating interface pair (d2-eth0,s1-eth2): RTNETLINK answers: File exists In order to solve the problem, you need to clean up the previous running topology by using the following command sudo mn -c It will clean up all your cache. It will be something like this $ sudo mn -c *** Re...

Run docker without sudo

By default, you have to run docker using sudo . When you try to run it without sudo, you will get $ docker images Got permission denied while trying to connect to the Docker daemon socket In order to run without sudo, you will need to do the following steps Add the docker group if it does not already exist sudo groupadd docker Add the user to the docker group. If you want to add the current user, you can just use this sudo gpasswd -a $USER docker If you want to add, say user user1 , then you should just do sudo gpasswd -a user1 docker After you do the above steps, log out and now you can run docker without sudo .