命令合集
整理一个用过的命令的地方,方便自己,也方便他人吧
Docker
Redis
- redis安装
docker pull redis:3.2 |
- Redis运行
~/redis$ docker run -p 6379:6379 -v $PWD/data:/data -d redis:3.2 redis-server --appendonly yes |
-p 6379:6379
: 将容器的6379端口映射到主机的6379端口
-v $PWD/data:/data
: 将主机中当前目录下的data挂载到容器的/data
redis-server --appendonly yes
: 在容器执行redis-server启动命令,并打开redis持久化配置
- 用redis-client端链接容器内部
docker exec -it 43f7a65ec7f8 redis-cli |
- 查看容器运行状况
docker ps |
MySQL
- Mysql 运行
docker run --name mysql -e MYSQL_ROOT_PASSWORD=admin -p 3306:3306 -d mysql:5.7.21 |
- 链接MySQL
docker run -it --rm \ |
Mongo
- Mongo 启动
# 不带验证 |
- 用户初始化
mongo |
Kafka
- Kafka 安装
docker pull wurstmeister/kafka:0.10.0.1 |
- Kafka 启动
docker run --name kafka \ |
- Kafka Manager
docker run -itd \ |
ZooKeeper
- ZooKeeper 安装
docker pull zookeeper |
- Zookeeper 启动
docker run --name some-zookeeper \ |
Druid-Imply
- Imply
docker run -p 8081-8110:8081-8110 -p 8200:8200 -p 9095:9095 -d --name imply imply/imply |
- Docker-Compose
docker-compose.yml:
version: '2' |
run
docker-compose up |
RabbitMQ
- RabbitMQ
docker run -d -p 15672:15672 -p 5672:5672 -v $PWD/rabbitmq:/var/lib/rabbitmq --name rabbitmq rabbitmq:management |
Database
MySQL
- 允许外部访问
grant all privileges on *.* to 'root'@'%' identified by 'admin'; |
- 查看编码
show variables like 'character%'; |
MongoDB
- 插入多条
db.inventory.insertMany([ |
- 查找全部
db.inventory.find( {} ) |
- 查找过滤条件
db.inventory.find( { status: "D" } ) |
- 条件查找
db.inventory.find( { size: { h: 14, w: 21, uom: "cm" } } ) |
- 选择DB
use myDB |
- 创建DB
use diyishuai |
The insertOne() operation creates both the database myNewDB and the collection myNewCollection1 if they do not already exist.
- 创建collection
db.myNewCollection2.insertOne( { x: 1 } ) |
- 按ObjectId查询
db.advertisement.find({"_id" : ObjectId("5b1f6e0fc365845f49a4ec2c")}) |
- 创建唯一索引
db.advertisement.ensureIndex({"name":1,"productId":1},{"unique":true}) |
- Mongo数据导出
mongodump -u shuai -p admin -d attr -o attr |
- Mongo数据导入
./bin/mongoimport --host localhost --port 27017 --db dbname --collection collectionName --username root --password pwd < mongo.json |
mongorestore -u shuai -p admin --db dashboard --dir data/db/dashboard |
Platform
Linux
- 端口占用查看
lsof -i:3306 |
- 关机
shutdown -h -t 10 |
-h
关机-t
延时多少s
- Hosname修改
hostnamectl set-hostname <newhostname> |
Windows
- 关机
shutdown -s -t 10 |
- 端口查看
netstat -ano |
Mac
- 关机
osascript -e 'tell app "System Events" to shut down' |
sudo shutdown -h 22:30 |
- base64 encode
cat file | base64 |
- base64 decode
cat file | base64 --decode |
MQ
RabbitMQ
- 添加远程用户
rabbitmqctl add_user root centirxlink123
rabbitmqctl set_user_tags root administrator
rabbitmqctl set_permissions -p / root ".*" ".*" ".*"
Kafka-Manager
- run
nohup bin/kafka-manager -Dconfig.file=conf/application.conf -Dhttp.port=9000 & |
BigData
Imply
- 启动
bin/supervise -c conf/supervise/quickstart.conf
Hadoop
- 授权
hdfs dfs -chown root:hdfs /user
Hive
查看表
show tables;
查看表结构
desc tableName;
查看表分区
show partitions tableName;
从分区中查询数据
1:
hive (DTS_DEV)> show partitions t_ut_raw_imp_log;
OK
partition
pt=2019-02-18
pt=2019-03-03
2:
select * from t_ut_raw_imp_log where pt='2019-03-03' limit 10;
云平台
腾讯云
ssh登录
ssh -i ~/.ssh/CentrixlinkMac root@di1shuai
Scp文件传输
scp -i ~/.ssh/CentrixlinkMac knife-1.0.jar root@di1shuai:/tmp
阿里云
- 访问Hadoop、Spark等WEB-UI
Copy自己的公钥到阿里云
自己的公钥path:~/.ssh/id_rsa.pub
阿里云验证path:/root/.ssh/authorized_keys配置自己本地的ssh
vi .ssh/config
Host jms
HostName jms.xxx.com
User username
Port 4500
Host emr
HostName hxxx.oxxx.sxxx.txxx
DynamicForward 3128
User root
Port 22
Host druid-master-1
HostName hxxx.oxxx.sxxx.txxx
DynamicForward 3128
User root
Port 22启动代理
nohup ssh -ND 8157 emr &
nohup ssh -ND 8158 druid-master-1 &
nohup ssh -ND 8159 us-hdfs-header-1 &启动代理chrome
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome Chrome --proxy-server="socks5://localhost:8157" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" --user-data-dir=/tmp/
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome Chrome --proxy-server="socks5://localhost:8158" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" --user-data-dir=/tmp/
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome Chrome --proxy-server="socks5://localhost:8159" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" --user-data-dir=/tmp/访问
http://localhost:8088
or50070
前端
Flutter
- 分支切换
flutter channel dev |
- 升级
flutter upgrade |
Project
- 创建项目
flutter create --org com.example --android-language java project_name |
Plugin
- 创建插件项目
flutter create --org com.example --template=plugin test_hover |
- 初始化插件
hover init-plugin github.com/my-organization/test_hover |
- null safety 检查
dart migrate |
- dart format
dartfmt -w . |
- 插件发布检查
flutter packages pub publish --dry-run |
- 插件发布
flutter packages pub publish |
Icon
- 生成icon
flutter pub run flutter_launcher_icons:main |
Desktop
Macos
- 启用macos
flutter config --enable-macos-desktop |
Code
- 开启边界模式
import 'package:flutter/rendering.dart'; |
Build
android
- app bundle
cd <app dir> |
- apk
cd <app dir> |
ios
go-flutter
Plugin
- 插件初始化
hover init |
- 插件获取
hover plugins get |
- 插件发布
hover plugins |
- 开发一个完整插件
|
Build
Mac
- 初始化
hover init-packaging darwin-dmg |
- 构建
hover build darwin-dmg |
本文标题:命令合集
文章作者:Shea
原始链接:https://di1shuai.com/命令合集.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!