Linux 常用命令笔记-2
注意事项:
沟通项目需求:
1.项目背景和目的
哪个团队、项目Wiki?
数据库登陆:mysql -uroot -pabc@0326 -h127.0.0.1 -P4004 -A
set names utf8;
SELECT count(*) FROM `g_map` WHERE ((status = 1 or status = 3) and name like 'zhong中%');
SELECT count(*) FROM `g_map` WHERE ((status = 1 or status = 3) and name='中');
SELECT `id`, `area`, `product_type`, `airport`, `type`, `source`, `name`, `status`, `send_status`, `online_status`, `admin_user_id`, `create_time`, `update_time`, `validate_time`, `admin_user_en`, `admin_user_cn`, `is_admin`, `is_parent`, `dead_line`, `canonical_country_code` FROM `g_map` WHERE ((status = 1 or status = 3) and name like '中%') ORDER BY id DESC LIMIT 4;
1. 登陆服务器:
ssh -p 35000 -o StrictHostKeyChecking=no -o ServerAliveInterval=60 whywanghaiyang@gzrelay.sys.dayunmotuo.com
dssh hostname
sudo -iu username
2. 下载线上文件:
> 下载文件到跳板机器
dscp whywanghaiyang@hostname:/home/log.wf.2018121916 ./
python -m SimpleHTTPServer 8100
> 在跳板机上启动HTTP服务
python -m SimpleHTTPServer 8100
3. 查询文件中关键字条数
grep key log.info | wc -l9655
4. 查看机器启动时间:
date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
2. 查询进程:
ps -aux | grep nginx | grep -v apache // 抓去nginx关键子,过滤掉包含apache关键字的条目
kill -9 nginx //直杀进程
5.
ifind -b hostname
ifind -t clustername
irun -c 'egrep 703687549066689 /home/log/log.error' | egrep -v Warning
irun -c 'egrep 703687549066689 /home/log/log.log' | egrep -v Warning
3. Redis 查询Geofence-updater key
hget key_601 207601
hgetall key_601
hval key_601 207601
4.
netstat -lntup |grep geofen
export GOPATH=/home//app/namespace
export GOROOT=/usr/local/go
ps -ef |grep name
pwdx 37830
netsta -atl | grep 8081
nc -l ip:port > a.txt
5. 测试工具
wrk -t8 -c200 -d30s --latency "http://www.bing.com"
6. 配置Gitlab的SSH
ssh-keygen -t rsa -C 'xxx@xxx.com'
复制内容:~/.ssh/id_rsa.pub
git更新单个文件:
git fetch
git checkout origin/master -- path/to/file
g
groupadd hadoop
useradd -d /home/hadoop -m hadoop -g hadoop
passwd hadoop
find /home -name filename
8. 查Linux版本
cat /etc/issue
7. 端口占用
Linux如何查看端口
1、lsof -i:端口号 用于查看某一端口的占用情况
2. netstat -tunlp |grep 端口号
8. 查看动态库链接
readelf -d libleveldb.so | grep NEEDED
SELECT `id`, `area`, `product_type`, `airport`, `type`, `source`, `name`, `status`, `send_status`, `online_status`, `admin_user_id`, `create_time`, `update_time`, `validate_time`, `admin_user_en`, `admin_user_cn`, `is_admin`, `is_parent`, `dead_line`, `canonical_country_code` FROM `table_name` WHERE `id`=? LIMIT 1 []interface {}{246023}
UPDATE `table_name` SET `area` = ?, `product_type` = ?, `type` = ?, `source` = ?, `name` = ?, `status` = ?, `send_status` = ?, `online_status` = ?, `admin_user_en` = ?, `admin_user_cn` = ?, `dead_line` = ?, `update_time` = ? WHERE (id = ?) []interface {}{41, 106, 116, 1, "城0719_3eebbc244be40c876afefe87da271df9", 1, 2, 1, "wangyajuanjessy", "王雅娟", "2019-06-10 18:08:06", "2018-12-11 16:36:21", 246023}
DELETE FROM `table_anme` WHERE (map_id = ?) []interface {}{246023}
BEGIN TRANSACTION
BEGIN TRANSACTION
INSERT INTO `table_name` (`map_id`, `map_item`, `name`, `center`, `radius`, `fence_type`, `administrative`, `create_time`, `update_time`, `canonical_country_code`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{246023, "[\"111.509439,40.784006\",\"111.515619,40.774127\",\"111.589090,40.788685\",\"111.621363,40.757485\",\"111.644708,40.746561\",\"111.687280,40.740839\",\"111.733286,40.753324\",\"111.742899,40.785565\",\"111.776544,40.803759\",\"111.794397,40.832859\",\"111.844522,40.856753\",\"111.889154,40.913857\",\"111.891901,40.935647\",\"111.871301,40.936165\",\"111.789591,40.893098\",\"111.725733,40.894655\",\"111.685221,40.888426\",\"111.626856,40.881158\",\"111.611063,40.871293\",\"111.608316,40.853637\",\"111.571237,40.835457\"]", "poly-item-1", "", 0, 1, 0, "2018-12-11 16:36:21", "2018-12-11 16:36:21", ""}
COMMIT
SELECT `id`, `map_id`, `map_item`, `name`, `center`, `radius`, `fence_type`, `administrative`, `create_time`, `update_time`, `canonical_country_code` FROM `table_name` WHERE (map_id = ?) []interface {}{246023}
ROLL BACK
### 压力测试
siege -c20 -r2 -H "Cache-Control: no-cache" -H "Postman-Token: c6eda32d-1f30-775f-6796-95383011bacc" -H "Content-Type: application/x-www-form-urlencoded" -d 'coords=39.8845,116.3256,40.8845,117.3256&token=3CF4BA9BDC761BA0&logid=1234567' "http://100.69.93.36:7081/fenceservice/infence"
Elasticsearch
集群如何启动:
ZenDiscovery 多数选主算法
lucen 倒排索引
mainconfig.GetMainConfig().UPM.Url + "/user/get/info?"
url = url + GetUpmParams() + "&userName=" + userName + "&withDefaultGrant=1"
appid=1802
appkey=eea2596baa8eb356f4db54ce990681de
url=http://100.69.238.12:8000/sec/upmapi
http://100.69.238.102:8000/sec/upmapi/user/get/info?appId=1802&appKey=eea2596baa8eb356f4db54ce990681de&time=1545196498&sign=d5cf954721e2392d392d1b56899baef7&userName=nimei&withDefaultGrant=1
egrep -o '\btoken:\S*\b' geofence-updater.log.wf | sort |uniq -c
egrep -o 'role=[0-9]+' | sort | uniq -c
查找文件:
find ./ -name "*.h* -or -name "*.cpp"
统计代码行数:
find ./ -name "*.h* -or -name "*.cpp" | xargs cat | wc -l
Xargs 使用
使用xargs命令进行每行切分:
posted on 2019-01-15 20:21 wanghaiyang1930 阅读(665) 评论(0) 编辑 收藏 举报