2018年8月2日 星期四

jetty 更改 session path

<New id="scm-webapp" class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/test</Set>
   
...

     <Get name="sessionHandler">
        <Set name="sessionManager">
            <New class="org.eclipse.jetty.server.session.HashSessionManager">
                <Set name="sessionPath">/</Set>
            </New>
         </Set>
      </Get>
  </New>


2018年8月1日 星期三

Change hostname in ubuntu 18.04

1. Change preserve_hostname in /etc/cloud/cloud.cfg to "true"
2. sudo hostnamectl set-hostname [your_hostname]
3. edit /etc/hosts
4. Logout and relogin

Running in background

nohup bash test.sh >/dev/null 2>&1 &

Mysql select tip for large tables

Assume id is the primary key

select * from my_table where id >= 123456789 limit 30

is much faster than

select * from my_table limit 123456789, 30

2018年7月31日 星期二

Add a new partition into LVM

sudo fdisk /dev/sda
# Create a new partition /dev/sda3

sudo pvcreate /dev/sda3
sudo pvdisplay
sudo vgdisplay

# ubuntu16044-vg is an existed volume group

sudo vgextend ubuntu16044-vg /dev/sda3

sudo vgdisplay
sudo lvdisplay

# /dev/ubuntu16044-vg/root is an existed logical volume

sudo lvextend -l 100%VG /dev/ubuntu16044-vg/root
sudo lvdisplay

sudo resize2fs /dev/ubuntu16044-vg/root [new_size]