ubuntu 18 sudo 卡頓

https://ywnz.com/linuxjc/2024.html 在Ubuntu Server 18.04 LTS下遇到了sudo速度非常慢的问题,具体表现是在提交命令之后大概需要10秒左右才有输入sudo密码或者开始运行,su命令同样也非常慢。这在升级前使用Ubuntu Server 16.04 LTS并没有,显然可能是Ubuntu Server 18.04 LTS版本的问题。 问题的原因 Ubuntu Server被设计成一种类似于分布式的操作系统网结构,允许/etc/sudoers中的成员不在本机上。从而sudo时会先从网络上寻找可能的sudoer然后才是本地,而这10s左右的时间就是整个DNS流程的最长时间。 解决办法 首先输入hostname,得到本机当前的互联网名称(大概跟windows下的计算机名称差不多)。然后使用su或sudo打开/etc/hosts,添加一行: 127.0.0.1计算机名计算机名.localdomain 关闭并保存。这样处理后sudo速度恢复正常。

2019-05-27 · 1 min · 18 words · Me

有人問docker

1、用docker-machine建立開發環境 (VM),vm內的docker 環境是完整的,自己灌很浪費時間 http://sueboy.blogspot.com/search/label/docker-machine 然後 記得vm裡面跑 portainer.io 管理docker用,web介面 會省下你一大堆時間! 以上這個步驟是快速建立可以跑docker環境,然後又可以用圖形管理看log、砍image等等 2、docker 一般操作網路上都有,一定要看,就算有圖形化介面,有些時候你還是需要指令 記得一件事,要學docker-compose,然後基本上專案用docker,更正確來說,是要會用、會寫docker-compose docker-compose 會比 單純用docker,好用很多 http://sueboy.blogspot.com/2018/12/ethereum-poa-docker-compose-docker.html 3、注意iptables,用docker後,常常會碰到iptables的問題,網路有問題,不能連,連不上,解答:把docker服務重開,就會重新設定iptables…這一堆人死在這上面 如果docker服務重開後,網路還是不行,我建議是用docker-machine重建一台vm比較快,再用docker-compose重新執行,比較快,省時間 4、通常用了docker的後端,十之八九就會想上K8s (kubernets) 到這階段就是超級大坑了!!! 非常大的坑! 會死人的坑! 到這階段千萬要避開,一定要避開! 坑指自架

2019-05-22 · 1 min · 26 words · Me

node-gyp rebuild failed windows 10

npm install –global windows-build-tools https://www.npmjs.com/package/windows-build-tools https://stackoverflow.com/questions/32457761/how-to-solve-node-gyp-rebuild-issue-on-windows-10

2019-05-22 · 1 min · 6 words · Me

truffle truffle-hdwallet-provider Error: Error: the tx doesn't have the correct nonce. account has nonce of: 3 tx has nonce of: 2

What this Error? Example: transaction A get nonce 1 transaction B get nonce 2 transaction C get nonce 3 But blockchain package B、C first, then package A. If happen this step, get error. With truffle? Because Normal const wallet = new HDWalletProvider(mnemonic, url, id); const AContract = new TruffleContract(Json_contract); AContract.setProvider(wallet); wallet.addresses[] AContract. use contract api Sometime you call contract “set/write” api two times. Example: Create contract first. Write data into contract second. This two step are in one function. This mean is you call two time “new HDWalletProvide”. Usually you think “New“ two time is ok, get “new” instance. But ...

2019-05-21 · 1 min · 134 words · Me

[???]nestjs Cross modules dependency injection

import module providers service So if you want use some controllers(this controllers is in some module), this time need to import module. ???? =========== https://github.com/zelazna/NestAPI/tree/master/src Impotant: constructor don’t use new(). Use this.usersService. src/auth/auth.service.ts import { Component } from '@nestjs/common'; import { UsersService } from '../users'; @Component() ?? Injectable export class AuthService { constructor( private readonly usersService: UsersService, ) { } async validateUser(signedUser): Promise { const { email, password } = signedUser; const user = await this.usersService.findOneByEmail(email); return await EncryptorService.validate(password, user.password); } Impotant: exports need UsersService ...

2019-05-13 · 1 min · 102 words · Me