2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS7まわりの踏んで認識したことと調べたメモ

Last updated at Posted at 2017-10-13

今更ですが備忘録です。ほぼポインタ集でもうしわけない。
バージョンが変わるから動くかどうかとかそういうミドルウェアレベルの細かいのはあんまりないです。

   以前は起動スクリプト2つ用意してたがそういう必要はなくなった模様

  • 概要をまず知らないといけない件

   RHEL 7 における systemd の概要 - Red Hat Customer Portal
   Linux女子部 systemd徹底入門
   https://www.amazon.co.jp/dp/4797382686/

  • ミドルのバージョンが変わったくらいで上書きされない確実に効くカスタマイズ設定方法を認識しておかないといけない件

   https://thinkit.co.jp/story/2014/12/11/5388?page=0%2C2
   https://qiita.com/nvsofts/items/529e422bb8a326401c39
   http://ksaito11.hatenablog.com/entry/2016/11/06/083900
   http://itpro.nikkeibp.co.jp/article/COLUMN/20140708/569987/?rt=nocnt
   http://enomotodev.hatenablog.com/entry/2016/09/24/014200

   システムが置くユニットファイルは/usr/lib/systemd/system/<unit名>.<unit種別>にあるが
   自分で設定する場合は/etc/systemd/system/<unit名>.<unit種別>.d/のしたに設定を置く。
   (/etc下側にファイルがある場合はそちらが優先的にロードされる)
   またはsystemctl edit <unit名>.<unit種別>と打つと、
   エディタが起動して編集保存すると/etc/systemd/system/<unit名>.<unit種別>.d/override.conf
   に差分ファイルが置かれる感じに。
   しかしeditオプション(7.2からつかえる)で起動されるエディタはデフォルトでnanoになっており、
   慣れてないのでvimにしたいというときはprofile的なファイルに以下のように設定するとよさそう。

export EDITOR="/usr/bin/vim"
export SYSTEMD_EDITOR="$EDITOR"
export VISUAL="$EDITOR"
export SUDO_EDITOR="$EDITOR"
  • sysctlのtcpまわりのメモリ増やしたりを起動スクリプトのスタートセクションに仕込んでいたのをどうやってやるのか特定したい件

前述したような位置に起動時のオプションを以下のように書いた設定ファイルを置くとよさそう(たぶん)

[Service]
ExecStart=
ExecStart=新しい設定 ##ラッパーつくるなりして変えたい場合
ExecStartPre=command1  ##ここに起動前処理をかく(起動処理の成否判定に関与しない)
ExecStartPost=command2 ##ここに起動後処理をかく(起動処理の成否判定に関与しない)

現状設定されてる書ける値などはsystemctl show --all <unit名>で確認可能。

/etc/tuned/tuned-main.confdynamic_tuning = 0(=動的変更無効)なら大丈夫でRedhat系はデフォルト無効らしい。

第3章 Tuned - Red Hat Customer Portal

↓azureのwaagentが初期化したところにNetworkManagerが上書きして混沌としたので潔く止めたAnsibleタスク

- name: check if cloud provider is azure
  action: command [ -x /usr/sbin/waagent ]
  register: result
  ignore_errors: True
  tags: check-if-provider-is-azure
- name: disable NetworkManager on azure
  service:
    name: NetworkManager
    enabled: no
  tags: disable-NetworkManager-azure
  when: result|succeeded

 起動スクリプトのスタートセクションにてprocの下のファイルにわざわざリダイレクトで書く必要はなくなり楽になった。

# mkdir /etc/systemd/system/httpd.service.d/
# cd /etc/systemd/system/httpd.service.d/
# vi 10-httpd.conf
[Service]
OOMScoreAdjust=-1000

ほかにもなんかありそうだけどもとりあえずこんなところで失礼します。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?