Tag Archives: database

[Solved] flask db migrate execute error: ERROR [flask_migrate] Error: Can‘t locate revision identified by ‘8d1ad59dc71a‘

Recently, a new table has been added to the flash project, but an error is reported when executing flash DB migrate, as shown in the following figure:

Google around the Internet and finally know the problem:
although the migration directory in the project has been deleted, the version information has been saved in the database. Yes, this is the table – alembic_ version

So all you have to do is delete the version record of this table:

After deletion, execute flash DB migrate again, no error is reported, and the table is generated normally ~

[Solved] Clickhouse Error: DB::Exception: Cannot lock file /var/lib/clickhouse/status

1、 Problem description

After the Clickhouse is started, it can be accessed by itself. There is no problem, and it can also be accessed externally. However, check its error log and find that there are always errors

tail -f clickhouse-server/clickhouse-server.err.log
output:
2020.10.07 19:05:32.720350 [ 8150 ] {} <Error> Application: DB::Exception: Cannot lock file /var/lib/clickhouse/status. Another server instance in same directory is already running.
2020.10.07 19:06:02.970577 [ 8217 ] {} <Error> Application: DB::Exception: Cannot lock file /var/lib/clickhouse/status. Another server instance in same directory is already running.
2020.10.07 19:06:33.220827 [ 8632 ] {} <Error> Application: DB::Exception: Cannot lock file /var/lib/clickhouse/status. Another server instance in same directory is already running.
2020.10.07 19:07:03.471225 [ 8706 ] {} <Error> Application: DB::Exception: Cannot lock file /var/lib/clickhouse/status. Another server instance in same directory is already running.
2020.10.07 19:07:33.720339 [ 8880 ] {} <Error> Application: DB::Exception: Cannot lock file /var/lib/clickhouse/status. Another server instance in same directory is already running.
...

It doesn’t stop, so it’s embarrassing.

2. Problem-solving

After probing, the Clickhouse server may have been started twice before. Therefore, check the status file directly according to the log directory

cat /var/lib/clickhouse/status
ps -ef | grep clickhouse-server
Delete the corresponding clickhouse-server
kill -9 $pid
systemctl start clickhouse-server

Then, check the error log again, and it’s OK

tail -f clickhouse-server/clickhouse-server.err.log

How to Solve svn error: WC DB

Go to sqlite official website (http://www.sqlite.org/download.html) to download sqlite3.exe

       Find Precompiled Binaries for Windows,Click sqlite-shell-win32-x86-3080500.zip to download,300KB

Show items hide folders Svn
Svn download sqlite.exe and place it in the .svn folder.
Configure the sqlite environment variable, copy the .svn root directory and add it to the global environment variable
execute sqlite3 .svn/wc.db “select * from work_queue” view the error message
delete the error file table sqlite3 .svn/wc.db “delete from work_queue”
If an error is reported that the database is locked – database is locked
execute sqlite3 .svn/wc.db “delete from wc_lock” delete locked information
return to the project file for clearup operation

Mongodb error: authentication failed [How to Solve]

Error Messages:

Database connect error:

com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName=‘root’, source=‘gateway’, password=, mechanismProperties=} Command failed with error 18 (AuthenticationFailed): ‘Authentication failed.’ on server 192.168.81.13:27017. The full response is {“ok”: 0.0, “errmsg”: “Authentication failed.”, “code”: 18, “codeName”: “AuthenticationFailed”}.

 

Solution:

Connect URL

mongodb://user:password@host:port/dbname

Add parameter authsource

For example:

mongodb://user:password@host:port/dbname?authSource=admin

In general, authsource is admin and can be replaced as needed

[Solved] Navicat Connect Error: Oracle library is not loaded.

Navicat connection error – Oracle library is not loaded

Error reason: OCI. Of Navicat installation package There is a problem with the DLL

Solution: Download instantclient basic windows on the official website of Oracle x64-11.2.0.4.0.zip

Note that the version should be the same as Navicat –> Tools –> Options –> Environment –> OCI environment –> oci. The version information in the address of DLL is consistent

Finally, restart Navicat

[Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “

Description

Today, when adding a MySQL slave node to the online production environment, the following error was reported when executing the command to back up MySQL data:

Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) "

The general meaning of error reporting is that MySQL under TMP cannot be found Sock file

Solution:

1. First find mysql Directory where the sock is located

find/-name mysql.sock

2. Create/TMP/MySQL Sock soft connect to the file
establish a soft connection (write an absolute path):

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

If the manual residual soft connection is wrong, you can delete it with the following command:

rm -rf /tmp/mysql.sock

Re-execute MySQL command, perfect solution!!

[Solved] redis Error: Can‘t save in background fork Cannot allocate memory

redis-cli -p 12345

[root@localhost ~]# redis-cli -p 6379
127.0.0.1:6379> auth "123456"
OK
127.0.0.1:6379> info
# Server
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7897e7d0e13773f
redis_mode:standalone
os:Linux 3.10.0-1127.19.1.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.5
process_id:1242
run_id:XXX
tcp_port:6379
uptime_in_seconds:1186639
uptime_in_days:13
hz:10
lru_clock:11977524
executable:/usr/bin/redis-server
config_file:/etc/redis.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:3486652368
used_memory_human:3.25G
used_memory_rss:3548164096
used_memory_rss_human:3.30G
used_memory_peak:3486886808
used_memory_peak_human:3.25G
total_system_memory:16637546496
total_system_memory_human:15.49G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:1.02
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:8
rdb_bgsave_in_progress:0
rdb_last_save_time:1639367433
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:20
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:3831251
total_commands_processed:18072447
instantaneous_ops_per_sec:15
total_net_input_bytes:1538227697
total_net_output_bytes:907587826299
instantaneous_input_kbps:0.61
instantaneous_output_kbps:3.07
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:7332354
keyspace_misses:6533
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:2025
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:1586.86
used_cpu_user:625.00
used_cpu_sys_children:3198.40
used_cpu_user_children:46091.06

# Cluster
cluster_enabled:0

# Keyspace
db0:keys=936,expires=0,avg_ttl=0

 

 

redis maxmemory:0 There is no limit to the amount of memory that can be used.
linux
[root@localhost redis]# sysctl -a|grep overcommit_memory
vm.overcommit_memory = 0
vm.overcommit_memory = 0 Heuristic The size of the virtual memory allocated for this request and the current free physical memory on the system plus swap determine whether to release it. When the system allocates virtual address space for the application process, it determines whether the size of the currently requested virtual address space exceeds the remaining memory size, and if it does, the virtual address space allocation fails.
When redis saves in-memory data to disk, in order to prevent the main process from falsely dying, it forks a child process to complete this save operation. However, the forked subprocess will need to allocate the same amount of memory as the main process, which is equivalent to double the amount of memory needed, and if there is not enough memory available to allocate the required memory, the forked subprocess will fail to save the data to disk.
/etc/redis.conf
[root@localhost etc]# more redis.conf |grep “stop-writes-on-bgsave-error”
stop-writes-on-bgsave-error yes
stop-writes-on-bgsave-error: Whether to continue processing Redis write commands when generating RDB files with errors, the default yes Redis does not allow users to perform any update operations
Reasons.
1 The memory of redis itself is not limited. maxmemory:0.
2 redis forks the same memory as the main process when it forks the process to save data, which is memory double.
3 linux server vm.overcommit_memory = 0, which does not allow excessive memory overcommits.
4 redis configuration file default stop-writes-on-bgsave-error, which does not allow users to exceed when writes fail.
Optimization suggestions.
Modify vm.overcommit_memory = 0 vm.overcommit_memory = 1

 

[Solved] ‘node’ command failed to start the project, with an error: “unknown database’ mydb ‘”

[error]
node the command failed to start the project and reported an error: “unknown database ‘mydb'”

[other features]
at this time, view phpstudy and display “port occupied”.

[solution]
Start Run CMD, enter netstat - ano , look at the first column, followed by the port, find 3306, and remember the corresponding PID

Then open the task manager to view -> Select column -> Tick PID (process identifier) -> determine

Find the PID process in the task manager, check what program occupies the port, and close it

If you restart MySQL again, you will not report the error that the port is occupied. ⑤ use postman to test whether the background project interface is normal

[Solved] jedis Connect redis Error: connect timed out

1. First check whether we are in redis.Conf or not and enter redis.conf if not.

(1) Find bind 127.0.0.1 under network and comment out this line.

(2) Find protected mode yes under network and change yes to No.

2. If this modification has not been solved, check the firewall.

systemctl status firewalld

If it’s like this, we can turn off the firewall

systemctl stop firewalld

Then we’ll test it again

After running, Pong solves the problem.

[Solved] Toad Set Error: The following files specified on the Executables tab could not be found:TNS Ping

Today, when the toad adjustment setting of the software is completed, click OK to always report
error: the following files specified on the executables tab could not be found: TNS Ping, as shown in the following figure

in fact, it is mainly caused by the setting problems in other places in the option, here we just need to modify the setting,
Select View toad options editor executables TNS Ping. Then check whether the path of your own command in the figure below is correct, or you can directly click the “auto search” button to automatically obtain the correct path

After that, click OK in other options in toad, and no error will be reported.

JPA multiple-data source startup error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘t

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'thirdlyConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.jpa.hibernate.thirdly-dialect' in value "${spring.jpa.hibernate.thirdly-dialect}"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:380) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$124/420595459.getObject(Unknown Source) ~[na:na]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:392) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$124/420595459.getObject(Unknown Source) ~[na:na]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
	at com.fy.FyApplication.main(FyApplication.java:17) [classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20]
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.4.RELEASE.jar:2.1.4.RELEASE]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.jpa.hibernate.thirdly-dialect' in value "${spring.jpa.hibernate.thirdly-dialect}"
	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$$Lambda$279/230589059.resolveStringValue(Unknown Source) ~[na:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:851) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1188) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	... 33 common frames omitted

The reason is that multiple data sources are configured, and in application The properties file does not use spring jpa.hibernate.Third dialect
just comment it out