mongoDB uninstall

mongoDB unistall

To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.

1) Stop MongoDB

Stop the mongod process by issuing the following command:

     sudo service mongod stop

2) Remove Packages.

Remove any MongoDB packages that you had previously installed.

     sudo apt-get purge mongodb-org*

3) Remove Data Directories.

Remove MongoDB databases and log files.

 sudo rm -r /var/log/mongodb
 sudo rm -r /var/lib/mongodb

参考:

askubuntu.com

 

** unistall 時に下記のエラーが発生した場合

dpkg: error processing package mongodb-org (--configure):
dependency problems - leaving unconfigured
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
mongodb-org-server
mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)

 

touch /etc/init.d/mongod

参考:

stackoverflow.com

AWS cloud9 でディスク容量がいっぱいになったとき

updated: 2020/6/3

 

#1 インスタンスから不要なファイルを削除する 

 

残存容量の確認

$ df /boot

 

定期的に不要なファイルを削除するコマンド

sudo apt-get autoremove を実行

 

以下のコマンドで比較的使用量の大きいディレクトリを確認できる

du -h -t 50M

 参考:

munibus.hatenablog.com

kisk0419.hatenablog.com

 

root ディレクトリに移動

cd //

 

最近更新したファイルを調べる

find . -type f -mmin -10

 

大きいファイルを調べる

du -h -t 50m

 

 ファイルの削除

sudo rm -rv FILENAME

 

参考:

Linuxコマンド集 - 【 rm 】 ファイルやディレクトリを削除する:ITpro

 

npm キャッシュのクリアー

npm cache clean or npm cache verify

 

composer キャッシュのクリアー

composer clear-cache

 

apacheアクセスログ、エラーログを消去

 cd /home/ubuntu/lib/apache2/log

sudo rm access.log

sudo rm error.log

sudo touch access.log

sudo touch error.log

 

 

#2 インスタンスのディスク容量自体を増やす

AWSコンソールのEC2を開く。

Elastic Block Store >>> ボリュームページを開く。

cloud9で使用しているボリュームにチェックを入れて上部コマンドバーのアクションからボリュームの変更⇒ボリュームの上限を増やす。

>>> 数分後自動で容量が増えますが反映されない場合あり。

>>> パーティションが12gまでしか割り当てられていないため拡張する必要あり。

 

ディスク容量の確認

f:id:monteecristoo:20191028233006p:plain

>>> /dev/xvda1が満容量

 

パーティションの割り当ての確認

f:id:monteecristoo:20191028233148p:plain

>>> xvda1のパーティションが12GB

 

パーティションの拡張

f:id:monteecristoo:20191028233306p:plain

f:id:monteecristoo:20191028233338p:plain

 

容量の拡張

f:id:monteecristoo:20191028234924p:plain

ref:

https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html

 

 

 

Laravel mail notification with pusher and mailtrap

Laravel で pusher を使った notification を受けて mailtrap 経由で通知メールを送る。

monteecristoo.hatenablog.com

上記の続き

@.env mailtrap のアカウント情報を記入

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=YOUR MAILTRAP USER NAME
MAIL_PASSWORD=YOUR MAILTRAP PASSWORD
MAIL_ENCRYPTION=null

 

@notification/NewFriendRequest.php

notification イベントに mail を追加

mail 本文の設定

public function via($notifiable)
{
return ['mail''broadcast', 'database'];
}

public function toMail($notifiable)
{
return (new MailMessage)
->line('You received a new frined request from' . $this->user->name )
->action('View profile', route('profile', ['user_id'=> $this->user->id ]))
->line('Thank you for using our application!');
}

f:id:monteecristoo:20171027210742j:plain

上記のような通知メールが発行される。

 

Noty installation with Laravel + Vue.js App

npm install noty --save

 

@resources/assets/js/bootstrap.js

window.noty = require('noty');

 

@app.blade.php

<script>

@if(Session::has('success'))

  new noty({
    type: 'success',
    layout: 'bottomLeft',
    text: '{{ Session::get('success') }}'
  });
@endif
</script>

-------------------------------------------------------------------------------------kati#8

 

noty/lib/noty.css を別個読み込ませる

参考:

laracasts.com