2020年9月21日 星期一

Mongodb 不正常關機後,重啟出現 Permission denied


確認Mongodb 設定檔 /etc/mongodb.conf

檢查Mongodb Log  /var/log/mongodb/mongod.log

2020-09-22T08:56:41.623+0800 W  STORAGE  [initandlisten] Failed to start up WiredTiger under any compatibility version.

2020-09-22T08:56:41.623+0800 F  STORAGE  [initandlisten] Reason: 13: Permission denied

2020-09-22T08:56:41.623+0800 F  -        [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 915


步驟一(重啟DB沒效)
# mongod --dbpath  /var/lib/mongodb --repair

步驟二
# sudo chown -R mongodb:mongodb /var/lib/mongodb
# sudo chown -R mongodb:mongodb /var/log/mongodb

檢查系統狀態,Mongodb成功開啟
# systemctl status mongod
● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-09-22 09:06:11 CST; 11min ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 11682 (mongod)
   CGroup: /system.slice/mongod.service
           └─11682 /usr/bin/mongod --config /etc/mongod.conf

Sep 22 09:06:11 db systemd[1]: Started MongoDB Database Server


2018年8月27日 星期一

CACTI 安裝於Ubuntu 1604

LAMP必須先安裝好

# vi /etc/apt/sources.list

於最後加入
deb http://ftp.ro.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.ro.debian.org/debian/ stretch main
deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main

#apt update
#apt upgrade

#apt install php7.0-snmp php7.0-xml php7.0-mbstring php7.0-json php7.0-gd php7.0-gmp php7.0-zip php7.0-ldap php7.0-mcrypt

# echo "date.timezone = Asia/Taipei" >> /etc/php/7.0/apache2/php.ini
# mysql -u root -p
MariaDB [(none)]> create database cacti;
MariaDB [(none)]> grant all on cacti.* to 'cactiuser'@'localhost' identified by 'password1';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit

# mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql
# mysql -u root -p -e 'grant select on mysql.time_zone_name to cactiuser@localhost'

# vi /etc/mysql/mariadb.conf.d/50-server.cnf   將下列加入底部
max_heap_table_size             = 98M
tmp_table_size                  = 64M
join_buffer_size                = 64M
innodb_buffer_pool_size = 485M
innodb_doublewrite              = off
innodb_flush_log_at_timeout     = 3
innodb_read_io_threads  = 32
innodb_write_io_threads = 16

# systemctl restart mysql apache2
# systemctl status mysql apache2

下載Cacti
# wget https://www.cacti.net/downloads/cacti-latest.tar.gz
# tar xfz cacti-latest.tar.gz
# cp -rf cacti-1.1.38/* /var/www/html

# rm /var/www/html/index.html
# touch /var/www/html/log/cacti.log
# chown -R www-data:www-data /var/www/html/
# vi /var/www/html/include/config.php        變更資料庫Cacti的密碼
$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'xxxxx';
$database_port     = '3306';
$database_ssl      = false;

#  mysql -u cactiuser cacti -p < /var/www/html/cacti.sql
# apt install snmp snmpd snmp-mibs-downloader rrdtool
# systemctl restart snmpd.service
# systemctl  status  snmpd.service
# ss -tulpn| grep snmp

下載及安裝Cacti-Spine
# apt install build-essential dos2unix dh-autoreconf help2man libssl-dev libmysql++-dev  librrds-perl libsnmp-dev libmysqlclient-dev libmysqld-dev

# wget https://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz
# tar xfz cacti-spine-latest.tar.gz
# cd cacti-spine-1.1.38
# ./bootstrap
# ./configure
# make
# make install
# chown root:root /usr/local/spine/bin/spine
# chmod +s /usr/local/spine/bin/spine
# vi /usr/local/spine/etc/spine.conf  新增檔案,加入下列

DB_Host localhost
DB_Database cacti
DB_User cactiuser
DB_Pass password1
DB_Port 3306
DB_PreG 0

http://IP/install























安裝完成

LAMP 安裝於Ubuntu 1604

安裝Apache
#  apt install apache2
# systemctl status apache2.service
# netstat -tlpn


打開瀏覽器http://IP 確認Apache 服務正常

如果Web要使用HTTPS,必須啟動Apache SSL
 # a2ensite default-ssl.conf
 # systemctl restart apache2.service
 # netstat -tlpn
















打開瀏覽器https://IP 確認Apache 服務正常

安裝PHP

# apt search php7.0
# apt install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-xml php7.0-gd
# php -v
# vi /var/www/html/info.php 新增此檔,內容如下:
<?php
phpinfo();
?>
# systemctl restart apache2
開啟瀏覽器 http://ip/info.php





















如果要額外安裝PHP模組,可以使用下列指令列出可安裝之麼組
# apt install php7.0











安裝MariaDB 10
# apt install php7.0-mysql mariadb-server mariadb-client
# mysql_secure_installation
# mysql
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set plugin=’‘ where User=’root’;
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> exit

# systemctl restart mysql.service
# mysql -u root -p





2018年6月27日 星期三

Splunk 安裝於Ubuntu 16.4 LTS

1. 在官方網站下載Splunk
2. 以Root權限安裝Splunk

# dpkg -i splunk-7.1.1-8f0ead9ec3db-linux-2.6-amd64.deb
Selecting previously unselected package splunk.
(Reading database ... 146804 files and directories currently installed.)
Preparing to unpack splunk-7.1.1-8f0ead9ec3db-linux-2.6-amd64.deb ...
Unpacking splunk (7.1.1) ...
Setting up splunk (7.1.1) ...
complete
# dpkg --status splunk
Package: splunk
Status: install ok installed
Maintainer: Splunk Inc. <info@splunk.com>
Architecture: amd64
Version: 7.1.1
Description: Splunk The platform for machine data.
# dpkg --list
Desired=Unknown/Install/Remove/Purge/Hold


ii  splunk              7.1.1          amd64          Splunk The platform for machine data.


# /opt/splunk/bin/splunk  start
:略
Do you agree with this license? [y/n]: y

This appears to be your first time running this version of Splunk.

An Admin password must be set before installation proceeds.
Password must contain at least:
   * 8 total printable ASCII character(s).
Please enter a new password: 輸入密碼
Please confirm new password: 再次輸入密碼
Copying '/opt/splunk/etc/openldap/ldap.conf.default' to '/opt/splunk/etc/openldap/ldap.conf'.
Generating RSA private key, 2048 bit long modulus
..................................................................................................................+++
..................................................+++
e is 65537 (0x10001)
writing RSA key

Generating RSA private key, 2048 bit long modulus
.......+++
..........+++
e is 65537 (0x10001)
writing RSA key

Moving '/opt/splunk/share/splunk/search_mrsparkle/modules.new' to '/opt/splunk/share/splunk/search_mrsparkle/modules'.

Splunk> Be an IT superhero. Go home early.

Checking prerequisites...
        Checking http port [8000]: open
        Checking mgmt port [8089]: open
        Checking appserver port [127.0.0.1:8065]: open
        Checking kvstore port [8191]: open
        Checking configuration...  Done.
                Creating: /opt/splunk/var/lib/splunk
                Creating: /opt/splunk/var/run/splunk
                Creating: /opt/splunk/var/run/splunk/appserver/i18n
                Creating: /opt/splunk/var/run/splunk/appserver/modules/static/css
                Creating: /opt/splunk/var/run/splunk/upload
                Creating: /opt/splunk/var/spool/splunk
                Creating: /opt/splunk/var/spool/dirmoncache
                Creating: /opt/splunk/var/lib/splunk/authDb
                Creating: /opt/splunk/var/lib/splunk/hashDb
New certs have been generated in '/opt/splunk/etc/auth'.
        Checking critical directories...        Done
        Checking indexes...
                Validated: _audit _internal _introspection _telemetry _thefishbucket history main summary
        Done
        Checking filesystem compatibility...  Done
        Checking conf files for problems...
        Done
        Checking default conf files for edits...
        Validating installed files against hashes from '/opt/splunk/splunk-7.1.1-8f0ead9ec3db-linux-2.6-x86_64-manifest'
        All installed files intact.
        Done
All preliminary checks passed.

Starting splunk server daemon (splunkd)...
Generating a 2048 bit RSA private key
...+++
..............................................................................................................................+++
writing new private key to 'privKeySecure.pem'
-----
Signature ok
subject=/CN=elk60/O=SplunkUser
Getting CA Private Key
writing RSA key
Done


Waiting for web server at http://127.0.0.1:8000 to be available.... Done


If you get stuck, we're here to help.
Look for answers here: http://docs.splunk.com

The Splunk web interface is at http://elk60:8000

完成安裝,開啟瀏覽器 ,以admin帳號,及前面輸入的密碼 








2018年5月2日 星期三

Avamar 備份task creation encountered a quiesce problem錯誤訊息

備份出現Completed w/Exception(s)   Error Code 10020





VM backups report Completed w/ Exception
參閱Article Number 000470426

於Avamar Administrator --> Tools --> Manage Datasets
Copy 並改名編輯及新的Datasets  (例如xxx_Quiesced)

選擇Option ->分別選擇  Windows VMware Image  Linux VMware Image


 Enter Attribute 欄位輸入 [avvcbimage]quiesce_fs
在 Under Enter Attribute Value 欄位輸入 false

在備份的Policy的Dataset選擇xxx_Quiesced的Dataset,即完成設定。


2017年12月18日 星期一

EMC Data Protection Advisor 6.4 安裝


  • OS: CentOS 7  *2 
  • 先安裝DPA Datastore,再安裝DPA Application (必要條件)
  • 安裝選項可將Datastore和Application裝在同一台,但是原廠支援的方式是兩個服務裝在不同機器(VM)的架構。
  • 使用FQDN

在CentOS 使用root權限,
安裝Datastore                                                                                               
# chmod +x EMC-DPA-Server-Linux-x86_64-6.4.0.8.bin
# ./EMC-DPA-Server-Linux-x86_64-6.4.0.8.bin

出現License Agreement   按Enter繼續

============================================================================
Choose Install Folder
---------------------

Please choose a target folder for the installation of the DPA services

Where would you like to install?

  Default Install Folder: /opt/emc/dpa

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
      :



============================================================================
Choose Install Set    務必先安裝Datastore
------------------

Please choose the Install Set to be installed by this installer.

  ->1- Application Service
    2- Datastore Service
    3- Application and Datastore Service

ENTER THE NUMBER FOR THE INSTALL SET, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
   : 2



=============================================================================
Low Memory Detected
-------------------

The installer has determined that while there is enough memory on the host to
permit the DPA services to start, the amount of memory is below the
recommended minimum.
Reason :Low memory availablity for installation

Performance and stability issue could arise if you decide to continue with the
installation.

Please increase the amount of memory allocated to this host.


PRESS <ENTER> TO ACCEPT THE FOLLOWING (OK):



=============================================================================
Advanced Configuration
----------------------


This installer is capable of supporting advanced installation options for the
service selected.

In most cases a standard (non-advanced) installation will suffice, but if you
would like to tailor the installation, please enter 'Y'.

Please note: advanced configuration options can be executed post installation
using the DPA command line interface.

Show Advanced Installation Options (Y/N): y



=============================================================================
Datastore Advanced Options
--------------------------


Advanced Datastore options are :

- Do not register DPA services
- Do not start DPA services
- Do install with advanced layout options
- Configure existing unix user account

Do you want to select advanced options (Y/N): N



=============================================================================
Pre-Installation Summary
------------------------

Review the following settings before proceeding

Product Name:
    Data Protection Advisor

Install Folder:
    /opt/emc/dpa

Install Set:
    Datastore Service

IPv4 Present
    TRUE

IPv6 Present
    TRUE

Disk Space Information (for Installation Target):
    Required:      873.3 MegaBytes
    Available: 39,173.16 MegaBytes

PRESS <ENTER> TO CONTINUE:



=============================================================================
Installing...
-------------
 
Please Wait
-----------

============================================================================
Please Wait
-----------

Creating DPA Datastore Service Account...
-

============================================================================
Please Wait
-----------

===============================================================================
Datastore Bind Addresses
------------------------


Please specify which IP addresses the datastore service should allow DPA
applications services access from.


Please also include the IP you wish to use for this machine.

Please note that listening addresses can be either IPv4 or IPv6, but not both.

    1- fe80:0:0:0:8474:410f:6836:170d%2
    2- 192.168.1.131

Select Option(s): 2



=============================================================================
Please Wait
-----------

Configuring the datastore bind address...
\

=============================================================================
Datastore Client Addresses
--------------------------

Please enter the IP addresses for all DPA application service hosts that will
connect to and use this datastore.


At least one IP address must be provided.
 Additional clients can be added to the datastore access using the DPA command
line interface.
    1- Add an Application Client Address
    2- Remove an Application Client Address

    3- Review and Complete

Select action: 3

At least one application node must be specified as a client to this datastore.

Current List:

    1- Add an Application Client Address
    2- Remove an Application Client Address

    3- Review and Complete

Select action: 3

At least one application node must be specified as a client to this datastore.

Current List:

    1- Add an Application Client Address
    2- Remove an Application Client Address

    3- Review and Complete

Select action: 1

New Address: 192.168.1.132             填入Application的IP

Current List:
            192.168.1.132

    1- Add an Application Client Address
    2- Remove an Application Client Address

    3- Review and Complete

Select action: 3

Current List:
            192.168.1.132
Completed ? (Y/N): y



===============================================================================
Please Wait
-----------

Configuring the datastore client address...
\

===============================================================================
Datastore Replication Option
----------------------------


By default the DPA datastore service is installed not configured for
replication.
If replication is required please enter 'Y' and then the role of this
datastore installation.
Do you wish to configure for replication (Y/N): Y           (如果要Replication這裡要選Yes)         
    1- Install datastore as a MASTER
    2- Install datastore as a SLAVE

Select replication role: 1



===============================================================================
Datastore Replication Data Entry
--------------------------------


This datastore is being installed as a MASTER datastore.

You can specify the address of the SLAVE datastore that it will replicate to
below, or specify it on the command line subsequently.

Note that the MASTER has been set to IPv4, so the SLAVE's address also needs
to be IPv4.
Enter IP address:



=============================================================================
Please Wait
-----------

=============================================================================
Agent Installation Options
--------------------------


Advanced Application options are :

- Do not start DPA Agent service
- DPA Agent will monitor Oracle Databases

Do you want to select advanced options (Y/N): n



=============================================================================
Configure Agent
---------------

Please enter the IP Address of the DPA Application Service that the installed
DPA Agent needs to communicate with.
Please note that if you are using clustered DPA Application servers you must
provide the Load balancer IP Address.

IP Address  (Default: 192.168.1.132):



=============================================================================
Please Wait
-----------

Installing DPA Datastore Service...
/

===============================================================================
Please Wait
-----------

Starting DPA Datastore Service...
|

===============================================================================
Please Wait
-----------

Creating required tablespaces...
/

=============================================================================
Set Datastore Password                             設定Datastore密碼         
----------------------


Please set the Datastore password.
The password must have:
- at least 9 characters
- at least 1 uppercase letter
- at least 1 lowercase letter
- at least 1 special character
- at least 1 digit

Enter Password:
Re-enter Password:



=============================================================================
Please Wait
-----------

Installing DPA Agent Service...
/

=============================================================================
Please Wait
-----------

Starting DPA Agent Service...
/

=============================================================================
Installation Complete
---------------------

Congratulations! Data Protection Advisor has been successfully installed to:

/opt/emc/dpa

For support, visit the Data Protection Advisor Product Page on the EMC Online
Support Site :

https://support.emc.com/products/829



PRESS <ENTER> TO EXIT THE INSTALLER:






安裝Application                                                                                            
# chmod +x EMC-DPA-Server-Linux-x86_64-6.4.0.8.bin
# ./EMC-DPA-Server-Linux-x86_64-6.4.0.8.bin


出現License Agreement   按Enter繼續

============================================================================
Choose Install Folder
---------------------

Please choose a target folder for the installation of the DPA services

Where would you like to install?

  Default Install Folder: /opt/emc/dpa

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
      :



============================================================================
Choose Install Set    
------------------

Please choose the Install Set to be installed by this installer.

  ->1- Application Service
    2- Datastore Service
    3- Application and Datastore Service

ENTER THE NUMBER FOR THE INSTALL SET, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
   : 1



=============================================================================
Low Memory Detected
-------------------

The installer has determined that while there is enough memory on the host to
permit the DPA services to start, the amount of memory is below the
recommended minimum.
Reason :Low memory availablity for installation

Performance and stability issue could arise if you decide to continue with the
installation.

Please increase the amount of memory allocated to this host.


PRESS <ENTER> TO ACCEPT THE FOLLOWING (OK):



=============================================================================
Advanced Configuration
----------------------


This installer is capable of supporting advanced installation options for the
service selected.

In most cases a standard (non-advanced) installation will suffice, but if you
would like to tailor the installation, please enter 'Y'.

Please note: advanced configuration options can be executed post installation
using the DPA command line interface.

Show Advanced Installation Options (Y/N): y



=============================================================================
Application Advanced Options
----------------------------


Advanced Application options are :

- Do not register DPA services
- Do not start DPA services
- Do install as a clusterable service

Do you want to select advanced options (Y/N): n



=============================================================================
Application Security Options
----------------------------


Advanced security option is :

- Use TLS 1.2 only
Configure the DPA service to use TLS protocol version 1.2 only.

DPA services running TLS protocol version 1.2 only are supported with DPA
Agent version 6.3 and later only.

Do you want to use TLS 1.2 only (Y/N): Y



=============================================================================
Pre-Installation Summary
------------------------

Review the following settings before proceeding

Product Name:
    Data Protection Advisor

Install Folder:
    /opt/emc/dpa

Install Set:
    Application Service

IPv4 Present
    TRUE

IPv6 Present
    TRUE

Disk Space Information (for Installation Target):
    Required:  1,284.62 MegaBytes
    Available: 39,173.4 MegaBytes

PRESS <ENTER> TO CONTINUE:


============================
Installing...
-------------

 [==================|==================|==================|==================]
 [------------------|------------------|------------------|------------------]



=============================================================================
Please Wait
-----------

Configuring to use TLS 1.2 only...
\

=============================================================================
Please Wait
-----------

Generating self-signed certificate...
-

=============================================================================
Identify the DPA Datastore to connect to
----------------------------------------

Please enter the IP Address for the instance of the DPA Datastore service that
this application service will connect to

Datastore Address (Default: ): 192.168.1.131




===============================================================================
Datastore Communication Failure     
Datastore OS的防火牆造成Applicaton安裝時的失敗,關閉Datastore的防火牆即可    
-------------------------------

The DPA Datastore service address entered is not visible from this host.
Please check the provided Address or your Network Configuration (including
Firewalls) to ensure that communications are available.

PRESS <ENTER> TO ACCEPT THE FOLLOWING (OK):


===============================================================================
Identify the DPA Datastore to connect to
----------------------------------------

Please enter the IP Address for the instance of the DPA Datastore service that
this application service will connect to

Datastore Address (Default: ): 192.168.1.131




===============================================================================
Please Wait
-----------



===============================================================================
Agent Installation Options
--------------------------


Advanced Application options are :

- Do not start DPA Agent service
- DPA Agent will monitor Oracle Databases

Do you want to select advanced options (Y/N): n



===============================================================================
Configure Agent
---------------

Please enter the IP Address of the DPA Application Service that the installed
DPA Agent needs to communicate with.
Please note that if you are using clustered DPA Application servers you must
provide the Load balancer IP Address.

IP Address  (Default: 127.0.0.1):



=============================================================================
Set Datastore Password            設定Datastore密碼
----------------------

Please set the Datastore password.
The password must have:
- at least 9 characters
- at least 1 uppercase letter
- at least 1 lowercase letter
- at least 1 special character
- at least 1 digit

Enter Password:
Re-enter Password:


===========================================================================
Set Administrator Password       設定管理者密碼
--------------------------


Please set the Administrator password.
The password must have:
- at least 9 characters
- at least 1 uppercase letter
- at least 1 lowercase letter
- at least 1 special character
- at least 1 digit

Enter Password:
Re-enter Password:



=============================================================================
Please Wait
-----------

Installing DPA Application Service...
\
=============================================================================
Please Wait
-----------

Starting DPA Application Service...
|

=============================================================================
Please Wait
-----------

Installing DPA Agent Service...
\

============================================================================
Please Wait
-----------

Starting DPA Agent Service...
-

============================================================================
Installation Complete
---------------------

Congratulations. Data Protection Advisor has been successfully installed to:

/opt/emc/dpa

Depending on the performance of the host servers, the initial startup of DPA
will typically take from 5 to 15 minutes. After this time, to launch the DPA
user interface, enter this URL into your web browser:

https://dpa-ap.domainname:9002


注意視窗彈跳封鎖,需使用flash。 administor / root的密碼





2017年12月7日 星期四

EMC Avamar 批次刪除或是expire儲存於DataDomain的大量備份



Avamar整合DataDomain時,如因備份空間不足時,需要刪除或是過期備份檔案。




使用modify-snapups 指令將2017/10/17前的backup列出,並產生expire 的Script
# modify-snapups --mode=expire --domain=/ --before=2017-10-17 > expire-backups-output-script.txt

或使用
modify-snapups 指令將一個月前的backup 列出,並建立出刪除的 Script。
# modify-snapups --mode=delete --domain=/ --before='1 month ago' > output-script.txt
# chmod +x output-script.txt

# more output-script.txt  


備份資料刪除後,DD並不會馬上就把空間清出,預設是每週二上午0600清除

可用df –h 查看可以刪除的檔案大小


sysadmin@dd# sysadmin@dd# filesys clean show schedule
Filesystem cleaning is scheduled to run "Tue" at "0600".
sysadmin@dd#

可以下指令直接方式清除
sysadmin@dd# sysadmin@dd#filesys clean start

並以下列指令察看進度
sysadmin@dd# sysadmin@dd#filesys clean watch