This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# install PPA | |
sudo add-apt-repository ppa:deadsnakes/ppa | |
# update and install | |
sudo apt update | |
sudo apt install python3.8 python3.8-dev python3.8-venv | |
# setup alternatives |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream back_server{ | |
ip_hash; | |
server 127.0.0.1:8000; | |
} | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 卸载Cloudera-Manager | |
sudo /usr/share/cmf/uninstall-cloudera-manager.sh 一直选择Yes 就好 | |
卸载完成后,它会问你是否要将database里的数据清理,选择Yes | |
2. 如果没有uninstall-cloudera-manager.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
所有的操作都是在root权限下进行 | |
硬件环境 | |
一台master | |
内存: 14G | |
操作系统 ubuntu 16.04 xenial | |
硬盘: 500G |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 [user] | |
2 email = '' | |
3 name = '' | |
4 emal = '' | |
5 [core] | |
6 excludesfile = ~/.gitignore_global | |
7 [difftool "sourcetree"] | |
8 cmd = opendiff \"$LOCAL\" \"$REMOTE\" | |
9 path = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
忽略抛出的异常: | |
常用的写法: | |
try: | |
os.remove('somefile.tmp') | |
except OSError: | |
pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu | |
sudo apt-get -y install git gcc make libpcap-dev | |
git clone https://github.com/robertdavidgraham/masscan | |
cd masscan/ | |
make | |
sudo make install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
当对后端的多台动态应用服务器做负载均衡时,ip_hash指令能够将某个客户端IP的请求通过哈希算法定位到同一台后端服务器上。这样,当来自某个IP的用户在后端Web服务器A上登录后,再访问该站点的其他URL,能够保证其访问的还是后端Web服务器A。 | |
如果不采用ip_hash指令,假设来自某个IP的用户在后端Web服务器A上登录后,再访问该站点的其他URL,有可能被定向到后端Web服务器B,C...上,由于用户登录后SESSION信息是记录在服务器A上的,B,C...上没有,这时就会提示用户来登录 | |
在ip_hash策略中,它选择最初的server的方法是根据请求客户真个IP计算出一个哈希值,再根据哈希值选择后台的服务器。 | |
1)由IP计算哈希值的算法如下, 其中公式中hash初始值为89,iphp->addr[i]表示客户真个IP, 通过三次哈希计算得出一个IP的哈希值: | |
for (i = 0; i < 3; i++) { | |
hash = (hash * 113 + iphp->addr[i]) % 6271; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Request-Reply模式: | |
server端: | |
#!/usr/bin/env python | |
# -*- coding=utf-8 -*- | |
import zmq | |
import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
系统 | |
# uname -a # 查看内核/操作系统/CPU信息 | |
# head -n 1 /etc/issue # 查看操作系统版本 | |
# cat /proc/cpuinfo # 查看CPU信息 | |
# hostname # 查看计算机名 | |
# lspci -tv # 列出所有PCI设备 | |
# lsusb -tv # 列出所有USB设备 | |
# lsmod # 列出加载的内核模块 | |
# env # 查看环境变量 |
NewerOlder