Skip to content

Instantly share code, notes, and snippets.

@lilongen
lilongen / parted.create.partition.cmdline
Created October 16, 2018 06:55
clear disk mbr, parted create partition table and create partition
dd if=/dev/zero of=/dev/sdb bs=512 count=1
parted /dev/sdb mklabel gpt
parted -a optimal /dev/sdb mkpart primary 0% 100%
parted /dev/sdb print
mkfs.xfs /dev/sdb1
1. go to mysql schema directory location
2. find -name "*.frm" -o -name "*.ibd" | xargs -i ln {} {}.lnh
3. execute drop tables
```
find /opt/tomcat7-* -name server.xml \
-exec perl \
-i.$(date +%04Y%02m%02d.%02k%02M%02S) \
-p -e 's/acceptCount="\d+"/acceptCount="500"/g' {} \;
#disk write benchmark
dd if=/dev/zero of=/tmp/1111 bs=4k count=16k conv=fdatasync
#network brandwidth benchmark
@lilongen
lilongen / clean.uninstall.cdh.on.centos7.bash
Created April 18, 2018 09:03
clean.uninstall.cdh.on.centos7
#!/bin/bash
# url: https://www.cloudera.com/documentation/enterprise/5-14-x/topics/cm_ig_uninstall_cm.html#concept_x4y_pgz_jm
#
# 1. Record User Data Paths
# 2. Stop all Services
# 3. Deactivate and Remove Parcels
# 4. Delete the Cluster
# 5. Uninstall the Cloudera Manager Server
# 6. Uninstall Cloudera Manager Agent and Managed Software
- yum upgdae
- ulimit setting
- stop firewalld
- disable selinux
- yum install ntp
- install oracle jdk
- install kdc server, client
- install mysql, postgresql
- ssh with public key
@lilongen
lilongen / kerberos.setup.md
Last active May 23, 2019 10:24
Setup kerberos on CentOS 7

install

yum -y install ntp

kdc server
yum -y install krb5-server krb5-libs

kerberos client
yum -y install krb5-workstation
@lilongen
lilongen / mysql57.usage
Last active January 29, 2018 03:17
mysql5.7 usage after install
1. MySQL5.7+ generates a temporary random password after installation and stored in /var/log/mysqld.log
2. get the temporay password to reset root password
grep "A temporary password is generated for root" /var/log/mysqld.log
3. a. mysql> uninstall plugin validate_password;
b. /etc/my.cnf
validate_password_policy=LOW
@lilongen
lilongen / mongo-date-range-query
Created January 5, 2017 09:59
mongo-date-range-query
var objIdMin = ObjectId(Math.floor((new Date('1990/10/10'))/1000).toString(16) + "0000000000000000")
var objIdMax = ObjectId(Math.floor((new Date('2011/10/10'))/1000).toString(16) + "0000000000000000")
db.myCollection.find({_id:{$gt: objIdMin, $lt: objIdMax}})
@lilongen
lilongen / runit-on-centos
Last active November 22, 2019 10:51
runit-on-centos
curl -s https://packagecloud.io/install/repositories/imeyer/runit/script.rpm.sh | sudo bash
yum install runit-2.1.2-1.el6.x86_64
yum install runit-2.1.1-7.el7.centos.x86_64
https://packagecloud.io/imeyer/runit/packages/el/6/runit-2.1.2-1.el6.x86_64.rpm?page=3
@lilongen
lilongen / mysql.support.utf8mb4
Last active July 27, 2016 07:17
mysql support utf8mb4
https://mathiasbynens.be/notes/mysql-utf8mb4
my.cnf
...
[client]
default-character-set = utf8mb4
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci