ページ

ラベル Fedora の投稿を表示しています。 すべての投稿を表示
ラベル Fedora の投稿を表示しています。 すべての投稿を表示

2015年1月31日土曜日

MySQL 5.5 の簡易チューニング

「mysqltuner」を使用することで、現状の改善点を出力してくれます。

Redhat系ディストリビューションならEPELレポジトリを使ってインストールすることができます。


# yum install mysqltuner

インストールが完了後、下記コマンドで実行する。
赤字は任意で変更!
# mysqltuner --user *user* --pass *password*
 >>  MySQLTuner 1.2.0 - Major Hayden 
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials passed on the command line

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.38-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in InnoDB tables: 12M (Tables: 38)
[--] Data in MyISAM tables: 11M (Tables: 8)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 7

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 2d 17h 5m 37s (7M q [29.946 qps], 1K conn, TX: 7B, RX: 575M)
[--] Reads / Writes: 98% / 2%
[--] Total buffers: 4.1G global + 8.8M per thread (256 max threads)
[OK] Maximum possible memory usage: 6.2G (9% of installed RAM)
[OK] Slow queries: 0% (0/7M)
[OK] Highest usage of available connections: 3% (9/256)
[OK] Key buffer size / total MyISAM indexes: 8.0M/10.8M
[OK] Key buffer hit rate: 100.0% (881M cached / 45K reads)
[OK] Query cache efficiency: 65.9% (4M cached / 6M selects)
[!!] Query cache prunes per day: 143882
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 3K sorts)
[OK] Temporary tables created on disk: 0% (0 on disk / 279 total)
[OK] Thread cache hit rate: 99% (9 created / 1K connections)
[OK] Table cache hit rate: 93% (93 open / 100 opened)
[OK] Open file limit used: 4% (73/1K)
[OK] Table locks acquired immediately: 99% (2M immediate / 2M locks)
[OK] InnoDB data size / buffer pool: 12.6M/4.0G

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
Variables to adjust:
    query_cache_size (> 16M)

基本的には my.cnf ファイルに対して修正・追加などを行う。
「Run OPTIMIZE TABLE to defragment tables for better performance」と出てるのですが、下記コマンドで自動実行が出来る。
# systemctl stop httpd
# mysqlcheck -u root -p --auto-repair --optimize --all-databases
# systemctl start httpd

2014年12月23日火曜日

Fedora 20 でLIO(Linux open source iSCSI target)のiSCSIを利用する

■ インストール

# yum install targetcli

■ 設定用のソフトを起動する

# targetcli

■ バージョンの確認

/> version
targetcli version 2.1.fb38

■ グローバル設定の変更

exit時にオートセーブされると参照時に困るので、変更する。
/> set global auto_save_on_exit=false
Parameter auto_save_on_exit is now 'false'.

ちなみにデフォルトのグローバル設定を見る場合は下記コマンドを実行する。
/> get global
GLOBAL CONFIG GROUP
===================
auto_add_mapped_luns=true
-------------------------
If true, automatically create node ACLs mapped LUNs after creating a new target LUN or a new node ACL

auto_cd_after_create=false
--------------------------
If true, changes current path to newly created objects.

auto_enable_tpgt=true
---------------------
If true, automatically enables TPGTs upon creation.

auto_save_on_exit=true
----------------------
If true, saves configuration on exit.

color_command=cyan
------------------
Color to use for command completions.

color_default=none
------------------
Default text display color.

color_keyword=cyan
------------------
Color to use for keyword completions.

color_mode=true
---------------
Console color display mode.

color_parameter=magenta
-----------------------
Color to use for parameter completions.

color_path=magenta
------------------
Color to use for path completions

completions_in_columns=true
---------------------------
If true, display completions in columns, not lines.

export_backstore_name_as_model=true
-----------------------------------
If true, the backstore name is used for the scsi inquiry model name.

logfile=/root/.targetcli/log.txt
--------------------------------
Logfile to use.

loglevel_console=info
---------------------
Log level for messages going to the console.

loglevel_file=debug
-------------------
Log level for messages going to the log file.

prompt_length=30
----------------
Max length of the shell prompt path, 0 for infinite.

tree_max_depth=0
----------------
Maximum depth of displayed node tree.

tree_round_nodes=true
---------------------
Tree node display style.

tree_show_root=true
-------------------
Whether or not to display tree root.

tree_status_mode=true
---------------------
Whether or not to display status in tree.


■ iSCSIを作成する

※以降、fileioとして記載します。

・fileio作成の場合のサンプル例
/backstores> cd /backstores/fileio
/backstores/fileio> create name=myscsi file_or_dev=/root/myscsi.img

使用するファイルは事前にddなどで作成しておく。
サンプル例は150GBのファイルを作成
# dd if=/dev/zero of=/root/myscsi.img bs=1G count=150


・iSCSI Target情報の作成
デバイス作成した後はiSCSI Targetとしての設定を行う。
※ターゲットのIPアドレスは自動的に設定される。
/backstores/fileio/myscsi> /iscsi create
Created target iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.03e804a17a22.
Created TPG 1.
Created default portal listening on all IPs (0.0.0.0), port 3260.

ターゲット名が既に決まっている場合は指定が出来る。
/backstores/fileio> /iscsi create iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.d2f860cab8b1
Created target iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.d2f860cab8b1.
Created TPG 1.
Created default portal listening on all IPs (0.0.0.0), port 3260.

・LUNを設定する
/backstores/fileio> cd /iscsi/iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.d2f860cab8b1/tpg1
/iscsi/iqn.20...60cab8b1/tpg1> luns/ create /backstores/fileio/myscsi
Created LUN 0.

・ACLを設定する
iSCSI Initiator側のイニシエータ名を指定します。
/iscsi/iqn.20...60cab8b1/tpg1> acls/ create iqn.1991-05.com.microsoft:zzz-pc
Created Node ACL for iqn.1991-05.com.microsoft:zzz-pc
Created mapped LUN 0.

・ターゲットシークレットを設定する
Windows7/8 のiSCSIイニシエーターだと認証無しだと
通過出来なかったのでユーザーとパスワードを設定します。
/iscsi/iqn.20...60cab8b1/tpg1> cd acls/iqn.1991-05.com.microsoft:zzz-pc
/iscsi/iqn.20...icrosoft:zzz-pc> set auth userid=hogeuser
Parameter userid is now 'hogeuser'.
/iscsi/iqn.20...icrosoft:zzz-pc> set auth password=mytargetsecret
Parameter password is now 'mytargetsecret'.

・設定情報を保存する
/iscsi/iqn.20...icrosoft:zzz-pc> cd /
/> saveconfig
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json

/> exit

・LIOを起動させる
# systemctl start target
# systemctl enable target

・再設定する場合
再度targetcliを行ってlsコマンドを打つと初期化状態に戻る時があります。
そんな時は下記のコマンドで設定状態を戻す。
/> restoreconfig /etc/target/saveconfig.json

2014年11月22日土曜日

Fedora 20 VNCでXfceを利用する


Xfceのインストールは事前に済ませておく!

VNC起動させるユーザーでログインしておく。
$ vi ~/.vnc/vncxfce4

#!/bin/sh
#### XFCE4 #####
xfce-mcs-manager &
xfwm4 &
xfdesktop &
xfce4-panel &
$ vi ~/.vnc/xstartup

#!/bin/sh

exec dbus-launch ~/.vnc/vncxfce4

あとはVNCサーバーを起動させればXfceが使用出来る。

VMware Workstation 10 起動時にエラーが発生して起動出来ない2

Fedora 20 (kernel 3.17) にてVMware Workstation 10をインストールし、起動しようとしたら
「virtual network device patch」の箇所でエラーが発生してうまく起動出来ない。

参考元URL:
https://communities.vmware.com/message/2434905

# cd /usr/lib/vmware/modules/source
# tar -xvf vmnet.tar
# vi vmnet-only/netif.c

dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
↓に変更する
dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup);

# tar -cf vmnet.tar vmnet-only
# rm -rf vmnet-only
# vmware-modconfig --console --install-all

うまくコンパイル出来れば通過して起動出来る。

2014年3月16日日曜日

VMware Workstation 10 起動時にエラーが発生して起動出来ない

Fedora 20 にてVMware Workstation 10をインストールし、起動しようとしたら
「VMware kernel module updater」というエラーが発生して起動出来ない。

参考元URL:
https://ask.fedoraproject.org/en/question/36038/vmware-fedora19-kernel-headers/
https://ask.fedoraproject.org/en/question/40926/trying-to-install-virtualbox-or-vmware-fedora-20/
https://communities.vmware.com/thread/466131

①必要なモジュールがインストールされていない。
⇒インストールする。(この時点ってVMwareのインストール出きていないのでは?)
# yum install kernel-devel kernel-headers gcc


②コンパイル時に必要なファイルが存在していない。
⇒シンボリックリンクで対応。
# sudo ln -s /usr/src/kernels/$(uname -r)/include/generated/uapi/linux/version.h /usr/src/kernels/$(uname -r)/include/linux/version.h

③上記を対応してもコンパイルエラーになって中断する。
⇒パッチを当てることで起動出来るようになる。
# curl http://pastie.org/pastes/8672356/download -o /tmp/vmware-netfilter.patch
# cd /usr/lib/vmware/modules/source
# tar -xvf vmnet.tar
# patch -p0 -i /tmp/vmware-netfilter.patch
# tar -cf vmnet.tar vmnet-only
# rm -rf vmnet-only
# vmware-modconfig --console --install-all


2013年8月6日火曜日

Fedora 16 以降 VNCサーバー のインストールから自動起動まで

インストール
# yum install -y xorg-x11-font* tigervnc-server tigervnc-server-module

fedoraユーザーでログインしてVNCパスワード設定をする。
# su - fedora
$ vncpasswd
Password:
Verify:

xstartupファイルを作成するため、一度起動して落とす。ついでにfedoraユーザーから抜ける。
$ vncserver :1 && vncserver -kill :1 && exit

自動起動用の設定ファイルをコピーしてくる。
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

ExecStartの行は書き換える。パラメータは必要に応じて各自設定すること。
# vi /etc/systemd/system/vncserver@:1.service
ExecStart=/sbin/runuser -l fedora -c "/usr/bin/vncserver :1 -geometry 1280x720 -depth 16 -fp /usr/share/X11/fonts/misc"

自動起動設定を行う。
# systemctl enable vncserver@:1.service
# systemctl start vncserver@:1.service

2013年7月28日日曜日

Fedora 16 以降 グラフィカルログイン ( GUI ) から テキストログイン ( CUI ) への切り替え

rm -f /etc/systemd/system/default.target
ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

reboot コマンドで再起動後、テキストログインに切り替わります。

2013年7月20日土曜日

最新バージョンの hostapd をインストールする。

Linux で 無線LANカード を アクセスポイント として利用するには hostapd を利用するのが手っ取り早いです。

そんなわけでサックリと入れてしましましょう。

GITから最新版を持ってきます。
# git clone git://w1.fi/srv/git/hostap.git
# cd hostap/hostapd

設定情報を変更します。
IEEE 802.11nとIEEE 802.11acは利用したいのでコメント外してyにしておく。
opensslを利用しない場合はコメント外してnoneに変更してください。
# cp defconfig .config
# vi .config

# IEEE 802.11n (High Throughput) support
CONFIG_IEEE80211N=y

# IEEE 802.11ac (Very High Throughput) support
CONFIG_IEEE80211AC=y

# Select TLS implementation
# openssl = OpenSSL (default)
# gnutls = GnuTLS
# internal = Internal TLSv1 implementation (experimental)
# none = Empty template
#CONFIG_TLS=openssl

上記設定でOpenSSLモジュールの設定をしていない場合は
OpenSSLを必要とするため、サクっといれておく。
ついでにnl80211ドライバもいれておく。
# yum install -y openssl-devel libnl-devel

あとは普通にインストールする。
# make && make install

2013年2月10日日曜日

Windows のリモートデスクトップ(RDP)で Fedora 18 へ接続する

事前にFedora側でVNCサーバーを構築してあることが前提。

インストール
# yum install -y xrdp

グループの追加
# groupadd xrdp
# usermod -G xrdp fedora

自動起動の設定
# systemctl start xrdp.service
# systemctl enable xrdp.service

あとはWindowsからリモートデスクトップで接続するだけ。
接続時はVNCで登録しているユーザーとパスワードを入力するだけでOK。

Fedora 18 でhostapdを利用して無線LAN AP構築

ソフトウェアのインストール


今回はAtherosチップ中心で検証していくので、
Linux用ドライバを先にインストールしておく。

カーネルバージョンに応じてココからドライバを取得する。

構築時のカーネルは 3.7.2 だったので 3.7 のドライバを取得する。
# wget "http://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.7-rc1/compat-drivers-3.7-rc1-6.tar.bz2"
# tar jxf compat-drivers-3.7-rc1-6.tar.bz2
# cd compat-drivers-3.7-rc1-6
# make && make install
# make unload
FATAL: Module bluetooth is in use.
# lsmod
Module                  Size  Used by
ath9k                 145352  0 
ath9k_common           13649  1 ath9k
ath9k_hw              399423  2 ath9k_common,ath9k
ath                    23143  3 ath9k_common,ath9k,ath9k_hw
mac80211              545141  1 ath9k
cfg80211              201547  3 ath,ath9k,mac80211

hostapdをインストールする。
# yum install libnl-devel
# wget "http://hostap.epitest.fi/releases/hostapd-2.0.tar.gz"
# tar zxvf hostapd-2.0.tar.gz
# cd hostapd-2.0/hostapd/
# cp -fp defconfig .config


IEEE 802.11nは利用したいのでコメント外してyにしておく。
opensslは利用しないのでnoneに変更しておく。
# vi .config

# IEEE 802.11n (High Throughput) support
CONFIG_IEEE80211N=y

# Select TLS implementation
# openssl = OpenSSL (default)
# gnutls = GnuTLS
# internal = Internal TLSv1 implementation (experimental)
# none = Empty template
#CONFIG_TLS=openssl
CONFIG_TLS=none

あとは普通にインストールする。
# make
# make install


2012年7月24日火曜日

Fedora 16 でLIO(Linux open source iSCSI target)のiSCSIを利用する

参考公式サイト ココココ

■ インストール


# yum -y install targetcli

■ 設定用のソフトを起動する


# targetcli

■ バージョンの確認


/> version
targetcli version 2.0rc1.fb8

■ 簡単な使い方


基本的に全てコマンドベースで作成していく。

・ルートからのディレクトリ階層

/> ls
o- / ........................................................... [...]
  o- backstores ................................................ [...]
  | o- block ...................................... [0 Storage Object]
  | o- fileio ..................................... [0 Storage Object]
  | o- pscsi ...................................... [0 Storage Object]
  | o- ramdisk .................................... [0 Storage Object]
  o- ib_srpt ............................................. [Not found]
  o- iscsi ................................................ [0 Target]
  o- loopback ............................................. [0 Target]
  o- qla2xxx ............................................. [Not found]
  o- tcm_fc .............................................. [Not found]


ヘルプは使用出来るコマンドの一覧が表示されるが、ディレクトリ階層で異なる。

・ルートディレクトリからのヘルプ

/> help

GENERALITIES
============
This is a shell in which you can create, delete and configure
configuration objects.

The available commands depend on the current path or target
path you want to run a command in: different path have
different sets of available commands, i.e. a path pointing at
an iscsi target will not have the same availaible commands as,
say, a path pointing at a storage object.

The prompt that starts each command line indicates your
current path. Alternatively (useful if the prompt displays
an abbreviated path to save space), you can run the
pwd command to display the complete current path.

Navigating the tree is done using the cd command. Without
any argument, cd will present you wil the full objects
tree. Just use arrows to select the destination path, and
enter will get you there. Please try help cd for navigation
tips.

COMMAND SYNTAX
==============
Commands are built using the following syntax:

[TARGET_PATH] COMMAND_NAME [OPTIONS]

The TARGET_PATH indicates the path to run the command from.
If ommited, the command will be run from your current path.

The OPTIONS depend on the command. Please use help
COMMAND to get more information.


AVAILABLE COMMANDS
==================
The following commands are available in the
current path:

  - bookmarks action [bookmark] 
  - cd [path] 
  - clearconfig [confirm] 
  - exit 
  - get [group] [parameter...] 
  - help [topic] 
  - ls [path] [depth] 
  - pwd 
  - refresh 
  - restoreconfig [savefile] [clear_existing] 
  - saveconfig [savefile] 
  - sessions [action] [sid] 
  - set [group] [parameter=value...] 
  - status 
  - version 
/> 


・backstoresへ移動

/> cd backstores
/backstores> ls
o- backstores .................................................. [...]
  o- block ........................................ [0 Storage Object]
  o- fileio ....................................... [0 Storage Object]
  o- pscsi ........................................ [0 Storage Object]
  o- ramdisk ...................................... [0 Storage Object]
/backstores>

・backstoresディレクトリからのヘルプ(一部抜粋)

/backstores> help

・・・ 抜粋 ・・・

AVAILABLE COMMANDS
==================
The following commands are available in the
current path:

  - bookmarks action [bookmark] 
  - cd [path] 
  - exit 
  - get [group] [parameter...] 
  - help [topic] 
  - ls [path] [depth] 
  - pwd 
  - refresh 
  - set [group] [parameter=value...] 
  - status 
/backstores> 


■ iSCSIを作成する


公式に書いてあるけれど、よくわからない。
作成後の自動移動?もしかしたらそのままの意味かも。とりあえず変更しておく。
/> set global auto_cd_after_create=false

作成出来るデバイスとして、投稿時点では4種類あります。

  • block   … 主に物理デバイス(HDD)を使用する
  • fileio   … ファイルを仮想ディスクとして使用する
  • pscsi   … 恐らくSCSIデバイスを使用する(未確認)
  • ramdisk … 自身のメモリを消費してRAM Diskとして利用する


・block作成の場合のサンプル例

/backstores> cd /backstores/block
/backstores/block> create name=myblock dev=/dev/disk/by-id/scsi-xxxx-part-1


・fileio作成の場合のサンプル例

/backstores> cd /backstores/fileio
/backstores/fileio> create name=myscsi file_or_dev=/root/myscsi.img buffered=true

/backstores/fileio> help
create name file_or_dev [size] [buffered] [sparse] 

[size] [sparse] に関してはよく分からない。
使用するファイルは事前にddなどで作成しておく。
サンプル例は150GBのファイルを作成
# dd if=/dev/zero of=/root/myscsi.img bs=1G count=150


・pscsi作成の場合のサンプル例

手持ちにSCSIデバイスが無いので未確認です。
使い方は他と変わらないのでSCSIデバイスを指定してあげれば行けるかも知れない。
/backstores> cd /backstores/pscsi
/backstores/pscsi> create name=xxxx dev=/dev/xxxx


・ramdisk作成の場合のサンプル例

RAM Diskとして自身のメモリをiSCSIデバイスとして提供出来ます。
物理メモリが沢山搭載されている場合に有効なデバイスだと思います。
RAM Diskとしての特性があると思うので、
データバックアップ・リストアを自分で行う必要有りです。
/backstores> cd /backstores/ramdisk
/backstores/ramdisk> create name=myram size=2G


・iSCSI Target情報の作成

デバイス作成した後はiSCSI Targetとしての設定を行う。
デバイス作成でname指定した名称へ移動する。
※以降、fileioとして記載します。
/backstores/fileio/myscsi> /iscsi create
Created target iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.d2f860cab8b1.
Created TPG 1.
Entering new node /iscsi/iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.d2f860cab8b1/tpg1


・LUNを設定する

/iscsi/iqn.20...60cab8b1/tpg1> cd /
/> cd /iscsi/iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.d2f860cab8b1/tpg1
/iscsi/iqn.20...60cab8b1/tpg1> luns/ create /backstores/fileio/myscsi
Created LUN 0.
Entering new node /iscsi/iqn.2003-01.org.linux-iscsi.hoge.x8664:sn.d2f860cab8b1/tpg1/luns/lun0


・iSCSI TargetのIPアドレスを設定する

/iscsi/iqn.20...60cab8b1/tpg1> portals/ create 192.168.2.109
Using default IP port 3260
Created network portal 192.168.2.109:3260.


・ACLを設定する

iSCSI Initiator側のイニシエータ名を指定します。
/iscsi/iqn.20...60cab8b1/tpg1> acls/ create iqn.1991-05.com.microsoft:zzz-pc
Created Node ACL for iqn.1991-05.com.microsoft:zzz-pc
Created mapped LUN 0.


・ターゲットシークレットを設定する

Windows7 のiSCSIイニシエーターだと認証無しだと
通過出来なかったのでユーザーとパスワードを設定します。
/iscsi/iqn.20...60cab8b1/tpg1> cd acls/iqn.1991-05.com.microsoft:zzz-pc
/iscsi/iqn.20...icrosoft:zzz-pc> set auth userid=hogeuser
Parameter userid is now 'hogeuser'.
/iscsi/iqn.20...icrosoft:zzz-pc> set auth password=mytargetsecret
Parameter password is now 'mytargetsecret'.


・設定情報を保存する

/iscsi/iqn.20...icrosoft:zzz-pc> cd /
/> saveconfig
Existing file /etc/target/saveconfig.json backed up to saveconfig.json.backup
Configuration saved to /etc/target/saveconfig.json
/> exit


・LIOを起動させる

# systemctl start targetcli.service
# systemctl enable targetcli.service


・再設定する場合

再度targetcliを行ってlsコマンドを打つと初期化状態に戻る時があります。
そんな時は下記のコマンドで設定状態を戻す。
/> restoreconfig /etc/target/saveconfig.json

2012年7月21日土曜日

Fedora16でのVNC Server

■ インストール

# yum -y install tigervnc-server
# su - fedora 
$ vncpasswd
$ vncserver :1
$ vncserver -kill :1



■  1環境のみの場合

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@1.service
# vi /etc/systemd/system/vncserver@1.service

ExecStart=/sbin/runuser -l fedora -c "/usr/bin/vncserver %i"
ExecStop=/sbin/runuser -l fedora -c "/usr/bin/vncserver -kill %i"

# systemctl start vncserver@1.service
# systemctl enable vncserver@1.service