Skip to content

Instantly share code, notes, and snippets.

@gbraccialli
Last active October 24, 2019 15:22
Show Gist options
  • Save gbraccialli/1f41b3eac43bf22b875f to your computer and use it in GitHub Desktop.
Save gbraccialli/1f41b3eac43bf22b875f to your computer and use it in GitHub Desktop.
#network
/etc/udev/rules.d/70-persistent-net.rules
#network
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
ONBOOT="yes"
TYPE="Ethernet"
NETMASK=255.255.255.0
IPADDR=10.20.11.140
#network
/etc/sysconfig/network
GATEWAY=10.20.11.1
#port and proccess
netstat -lntup #list all server ports
netstat -natp | grep 61616 #find pid by port number
netstat -nputw | grep 10.0.0.1 #all connections attempts
netstat -nputwc | grep 10.0.0.1 #continuous
lsof -i :10000
ps auxwwwf
ps axwwo "pid user size rss etime cputime args" | sort -n -k +4
#version:
cat /etc/*release*
#ssh tunnel:
ssh root@sandbox -L 81:localhost:80 -N
ssh -o ServerAliveInterval=10 -i <<credentials.pem>> -N -L 8192:<<master-public-dns-name>>:8192 hadoop@<<master-public-dns-name>>
ssh -g -N -C -p 22 [email protected] -L 10.0.0.1:2222:192.168.0.1:22
#timezone:
/etc/localtime
#yum
yum update --disablerepo='*' --enablerepo=xxx
#nmon:
wget http://sourceforge.net/projects/nmon/files/nmon_x86_64_centos6
cp nmon_x86_64_centos6 /usr/bin/nmon
chmod +x /usr/bin/nmon
#xforwarding on mac:
on linux: yum install xorg-x11-xauth
on mac: Insall XQuartz
on mac: ssh -X root@host
#hdfs nfs:
sudo mount -t nfs -o vers=3,proto=tcp,nolock sandbox.hortonworks.com:/ /mnt/hdfs
vi /etc/fstab
sandbox.hortonworks.com:/ /mnt/hdfs nfs vers=3,proto=tcp,nolock 0 0
#split:
split --bytes=200M /some/file /some/dir && for i in `ls /some/dir` ; do hadoop fs -put $i /some/hdfs/dir & ; done
#samba:
yum install samba samba-client samba-common
vi /etc/samba/smb.conf
[global]
workgroup=WORKGROUP
server string=Samba Server %v
netbios name=sandbox.hortonworks.com
security=user
map to guest=bad user
dns proxy=no
#============================ Share Definitions ==============================
[Anonymous]
path=/mnt/hdfs
browsabl=yes
writable=yes
guest ok=yes
read only=no
[blob]
path=/mnt/blob/code/
browsable=yes
writable=yes
guest ok=yes
read only=no
force user = root
force group = root
service smb restart
service nmb restart
chkconfig smb on
chkconfig nmb on
#increase partition root ec2/aws:
http://serverfault.com/questions/414983/ec2-drive-not-ebs-volume-size
#clean cached memory:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
#find recursively sort by date:
find . -type f -printf "%TY-%Tm-%Td %TH:%TM:%TS %p\n" | sort
#remove empty files in hadoop
hadoop fs -ls -R /test | grep " 0" | grep -v drwx | awk '{print $8}' | xargs hadoop fs -rm
#verify networks errors:
netstat -nip
#process using deleted files
lsof +L1
#rpm without denpendencies
rpm -Uvh --nodeps $(repoquery --location winswitch)
rpm -Uvh --nodeps http://mirror.proserve.nl/centos/7.2.1511/os/x86_64/Packages/postgresql-jdbc-9.2.1002-5.el7.noarch.rpm
DATE=`date +%Y%m%d-%H%M%S`
https://www.pythian.com/blog/virtual-cpus-with-amazon-web-services/
taskset -pc 0,1 $$
for i in {1..2}; do dd if=/dev/zero bs=1M count=2070 2> >(grep bytes >&2 ) | gzip -c > /dev/null & done
sudo initctl list | sort
yarn node -list|sed -n "s/^\(ip[^:]*\):.*/\1/p" | xargs -t -I{} -P10 ssh -o StrictHostKeyChecking=no {} "sudo stop hadoop-yarn-nodemanager"
#ACL all users with permission to write on a directory
chown $project_user:$project_user ${DATA_VOLUME_MOUNT_POINT}/shared
chmod 3770 ${DATA_VOLUME_MOUNT_POINT}/shared
setfacl -d -m g::rwx ${DATA_VOLUME_MOUNT_POINT}/shared
setfacl -d -m o::--- ${DATA_VOLUME_MOUNT_POINT}/shared
echo "* * * * * chgrp $project_user -R ${DATA_VOLUME_MOUNT_POINT}/shared; chmod g+rwX -R ${DATA_VOLUME_MOUNT_POINT}/shared" | crontab - (edited)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment