SeisComp3 - Configuration
Contents
我会用几篇的博客内容来记录对 SeisComP3 的学习总结。上篇介绍了 SeisComP3 的安装,这篇主要介绍 SeisComP3 的首次配置。
1. License key
如果GFZ 已经发了License.crt,那么
$ mkdir -p ~/.seiscomp3/key
$ tar xf cug.tar.gz ~/.seiscomp3/key
2. Environment tweak
环境配置完成后,SC 3 命令执行就不需要加 ~/seiscomp3/bin/seiscomp
。
$ seiscomp3/bin/seiscomp print env
...
$ seiscomp3/bin/seiscomp print env >> ~/.bashrc
$ source ~/.bashrc
3. Configuration
配置有两种途径,一是图形配置$ Scconfig
,SC 3 大部分命令都是以sc开头;二是在终端中进行$ seiscomp setup
。二者并无实际区别。
$ seiscomp setup
# CUG是我们学校代号,与License key无关联,可随意填写
# []中的信息为默认值,回车即为默认
Agency ID []: CUG
Datacenter ID []:CUG
Organization string []:CUG
Enable database storage [yes]:
0)mysql
1)postgresql
Database backend [0]:
Create database [yes]:
# 这里如果是Root用户,在建立Mysql时,没有创建密码,则不需要输入密码
# 如果是其他原因创建了密码,则在此处输入密码。
# 忘记密码,或者密码提示不对,或者其他错误,请看下面的配置出现的常见错误
MYSQL root password (input not echoed) []:
# 重新安装就不需要重新建库,此处输入 yes,否则会出现下面介绍的常见错误5。
Drop exsiting database [no]:
Database name [seiscomp3]:
Database hostname [localhost]:
Database read-write user [sysop]:
Database read-write password [sysop]:
Database public hostname [localhost]:
Database read-only user [sysop]:
Database read-only password [sysop]:
Command? [P]:
如果没有任何报错(ERROR),证明配置成功。
4. Mysql Error
常见错误1
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
解决方案:
$ sudo mysql -u root # I had to use "sudo" since is new installation
mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;
如果root用户在使用auth_socket插件,则可以:
$ sudo mysql -u root # I had to use "sudo" since is new installation
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ service mysql restart
参考见解决MySQL的 ERROR 1698 (28000)。
如果上述方案仍未解决,建议重新安装 mysql ,安装过程中设置密码:
重装时一定要彻底删除 mysql,防止其他问题出现:
$ sudo apt-get remove mysql-*
$ dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
yes !!!
常见错误2
ERROR 2002 (HY000): Can't connect to local Mysql server through socket '/tmp/mysql.sock' (2)
error: module 'scmaster' failed to setup
解决方案:
$ find / -name mysql.scok
情况1:
找见了mysql.sock
,比如在/var/lib/
中,则
$ ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
详情请参考ERROR 2002 (HY000)。
情况2:
未找见mysql.sock
,请参考亲测有效,解决Can ’t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “。
常见错误3
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
$ systemctl status mysqld.service
Starting MySQL..... ERROR! The server quit without updating PID file.
解决方案:
$ sudo mv /etc/my.cnf /etc/my.cnf.backup
$ service mysql restart
详情请参考 MySQL: Starting MySQL….. ERROR!。
常见错误4
+ Create MYSQL database
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决方案:
$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
找到[mysqld]段,并加入一行"skip-grant-tables"
[mysqld]
#
# * Basic Settings
#
skip-grant-tables
user = mysql
# 保存退出
$ service mysql restart
$ mysql
mysql> use mysql
mysql> update mysql.user set authentication_string=password('newpass') where user='root' and Host ='localhost';
mysql> update user set plugin="mysql_native_password";
mysql> flush privileges;
mysql> quit;
# mysql 密码为 newpass
# 注释或删除 /etc/mysql/mysql.conf.d/mysqld.cnf 中"skip-grant-tables"行
$ service mysql restart
$ mysql -u root -p
Enter password:
常见错误5
ERROR 1007 (HY000) at line 1: Can't create database 'seiscomp3'; database exists
- Failed to setup database
error: module 'scmaster' failed to setup
解决方案:
Drop existing database [no]: yes
下一章节:SeisComP3 开启。
Author Qiang
LastMod 2019-10-09