Difference between revisions of "User:Pavila"
From OpenKM Documentation
(→Books) |
(→MySQL) |
||
(39 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
OpenKM Core developer. | OpenKM Core developer. | ||
+ | |||
+ | '''Cluster''' | ||
+ | $ mysql -h 192.168.0.100 -u root -p | ||
+ | mysql> CREATE USER openkm@192.168.0.100 IDENTIFIED BY 'openkm'; | ||
+ | mysql> GRANT ALL ON okmdb.* TO openkm@192.168.0.100; | ||
+ | |||
+ | '''Application with CLOSE_WAIT''' | ||
+ | <source lang="bash"> | ||
+ | sudo netstat -tonp | grep CLOSE_WAIT | ||
+ | </source> | ||
+ | |||
+ | See: | ||
+ | * [http://unix.stackexchange.com/questions/10106/orphaned-connections-in-close-wait-state Orphaned connections in CLOSE_WAIT state] | ||
+ | * [http://stackoverflow.com/questions/5636316/troubleshooting-connections-stuck-in-close-wait-status Troubleshooting connections stuck in CLOSE_WAIT status] | ||
+ | * [http://www.sunmanagers.org/pipermail/summaries/2006-January/007068.html How to break CLOSE_WAIT] | ||
+ | |||
+ | '''File descriptors used by Tomcat''' | ||
+ | <source lang="bash"> | ||
+ | sudo lsof -p $(ps -ef | grep java | grep tomcat | awk '{ print $2 }') | wc -l | ||
+ | </source> | ||
+ | |||
+ | '''Show charset and locale configuration''' | ||
+ | <source lang="java"> | ||
+ | import java.util.*; | ||
+ | import java.nio.charset.*; | ||
+ | |||
+ | print("Charset: " + Charset.defaultCharset()+"<br/>"); | ||
+ | print("Locale: " + Locale.getDefault()+"<br/>"); | ||
+ | </source> | ||
+ | |||
+ | '''Show Java version''' | ||
+ | <source lang="java"> | ||
+ | print("Java Vendor: " + System.getProperty("java.vm.vendor")+"<br/>"); | ||
+ | print("Java Version: " + System.getProperty("java.version")+"<br/>"); | ||
+ | </source> | ||
+ | |||
+ | '''Fix permissions''' | ||
+ | <source lang="bash"> | ||
+ | find -name "*.okm" -exec sed -i 's/<font>//g' {} \; | ||
+ | find -name "*.okm" -exec sed -i 's/<\/font>//g' {} \; | ||
+ | find -name "*.okm" -exec sed -i 's/<font class="">//g' {} \; | ||
+ | </source> | ||
+ | |||
+ | If you have problems read [http://perlgeek.de/en/article/set-up-a-clean-utf8-environment How to set up a clean UTF-8 environment in Linux]. | ||
+ | |||
+ | '''Find duplicates - HSQL''' | ||
+ | <source lang="sql"> | ||
+ | select nd.uuid, nd.name, ndv.checksum from NodeDocument nd, NodeDocumentVersion ndv where nd.uuid = ndv.parent and ndv.checksum in | ||
+ | (select ndv.checksum from NodeDocumentVersion ndv where ndv.current = true group by ndv.checksum having count(ndv.checksum) > 1) | ||
+ | order by ndv.checksum, nd.name; | ||
+ | </source> | ||
+ | |||
+ | '''Find duplicates - SQL''' | ||
+ | <source lang="sql"> | ||
+ | select NBS_UUID, NBS_NAME, NDV_CHECKSUM from OKM_NODE_BASE, OKM_NODE_DOCUMENT_VERSION where NBS_UUID = NDV_PARENT and NDV_CHECKSUM in | ||
+ | (select NDV_CHECKSUM from OKM_NODE_DOCUMENT_VERSION where NDV_CURRENT='T' group by NDV_CHECKSUM having count(NDV_CHECKSUM) > 1) | ||
+ | order by NDV_CHECKSUM, NBS_NAME; | ||
+ | </source> | ||
+ | |||
+ | '''Find documents with assigned roles''' | ||
+ | <source lang="sql"> | ||
+ | select count(*) from NodeDocument nd where size(nd.rolePermissions) > 0; -- Slower | ||
+ | select count(*) from NodeDocument nd where exists elements(nd.rolePermissions); -- Faster | ||
+ | </source> | ||
+ | |||
+ | '''Find documents with a keyword''' | ||
+ | <source lang="sql"> | ||
+ | from NodeDocument nd where 'xxx' in elements(nd.keywords); | ||
+ | </source> | ||
+ | |||
+ | '''Find documents with a role''' | ||
+ | <source lang="sql"> | ||
+ | from NodeDocument nd left join nd.rolePermissions as rolePerms where index(rolePerms) = 'ROLE_USER'; | ||
+ | </source> | ||
+ | |||
+ | '''Show documents in trash''' | ||
+ | <source lang="sql"> | ||
+ | select nbase.NBS_UUID, nbase.NBS_NAME, nbase.NBS_CONTEXT from OKM_NODE_DOCUMENT ndoc, OKM_NODE_BASE nbase where ndoc.NBS_UUID = nbase.NBS_UUID and NBS_CONTEXT='okm_trash'; | ||
+ | </source> | ||
+ | |||
+ | == MySQL == | ||
+ | <source lang="sql"> | ||
+ | SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') | ||
+ | FROM information_schema.tables | ||
+ | WHERE table_schema = 'okmdb'; | ||
+ | </source> | ||
+ | |||
+ | Para que no molestar la integridad referencial: | ||
+ | |||
+ | <source lang="sql"> | ||
+ | SET FOREIGN_KEY_CHECKS = 0; | ||
+ | drop table if exists ...; | ||
+ | drop table if exists ...; | ||
+ | drop table if exists ...; | ||
+ | SET FOREIGN_KEY_CHECKS = 1; | ||
+ | </source> | ||
+ | |||
+ | Para que no salgan los resultados con separadores hay que iniciar MySQL así: | ||
+ | |||
+ | <source lang="bash"> | ||
+ | $ mysql -h localhost -u root -p -s -r | ||
+ | </source> | ||
== TO DO == | == TO DO == | ||
Line 10: | Line 112: | ||
* [[User:Pavila/Books/User Guide|User Guide]] | * [[User:Pavila/Books/User Guide|User Guide]] | ||
* [[OpenKM_Documentation:Books|Books]] | * [[OpenKM_Documentation:Books|Books]] | ||
+ | * [[Blog articles]] | ||
== See also == | == See also == | ||
+ | * [[Translation]] | ||
+ | * [[Debug log info]] | ||
+ | * [[Source code contributions]] | ||
+ | * [[Testing LDAP configuration]] | ||
+ | * [[OpenOffice configuration issues]] | ||
* [[User talk:Svaitsis.gss]] | * [[User talk:Svaitsis.gss]] | ||
+ | * [[MediaWiki:Monobook.css]] |
Latest revision as of 19:23, 14 November 2013
OpenKM Core developer.
Cluster
$ mysql -h 192.168.0.100 -u root -p mysql> CREATE USER openkm@192.168.0.100 IDENTIFIED BY 'openkm'; mysql> GRANT ALL ON okmdb.* TO openkm@192.168.0.100;
Application with CLOSE_WAIT
sudo netstat -tonp | grep CLOSE_WAIT
See:
- Orphaned connections in CLOSE_WAIT state
- Troubleshooting connections stuck in CLOSE_WAIT status
- How to break CLOSE_WAIT
File descriptors used by Tomcat
sudo lsof -p $(ps -ef | grep java | grep tomcat | awk '{ print $2 }') | wc -l
Show charset and locale configuration
import java.util.*;
import java.nio.charset.*;
print("Charset: " + Charset.defaultCharset()+"<br/>");
print("Locale: " + Locale.getDefault()+"<br/>");
Show Java version
print("Java Vendor: " + System.getProperty("java.vm.vendor")+"<br/>");
print("Java Version: " + System.getProperty("java.version")+"<br/>");
Fix permissions
find -name "*.okm" -exec sed -i 's/<font>//g' {} \;
find -name "*.okm" -exec sed -i 's/<\/font>//g' {} \;
find -name "*.okm" -exec sed -i 's/<font class="">//g' {} \;
If you have problems read How to set up a clean UTF-8 environment in Linux.
Find duplicates - HSQL
select nd.uuid, nd.name, ndv.checksum from NodeDocument nd, NodeDocumentVersion ndv where nd.uuid = ndv.parent and ndv.checksum in
(select ndv.checksum from NodeDocumentVersion ndv where ndv.current = true group by ndv.checksum having count(ndv.checksum) > 1)
order by ndv.checksum, nd.name;
Find duplicates - SQL
select NBS_UUID, NBS_NAME, NDV_CHECKSUM from OKM_NODE_BASE, OKM_NODE_DOCUMENT_VERSION where NBS_UUID = NDV_PARENT and NDV_CHECKSUM in
(select NDV_CHECKSUM from OKM_NODE_DOCUMENT_VERSION where NDV_CURRENT='T' group by NDV_CHECKSUM having count(NDV_CHECKSUM) > 1)
order by NDV_CHECKSUM, NBS_NAME;
Find documents with assigned roles
select count(*) from NodeDocument nd where size(nd.rolePermissions) > 0; -- Slower
select count(*) from NodeDocument nd where exists elements(nd.rolePermissions); -- Faster
Find documents with a keyword
from NodeDocument nd where 'xxx' in elements(nd.keywords);
Find documents with a role
from NodeDocument nd left join nd.rolePermissions as rolePerms where index(rolePerms) = 'ROLE_USER';
Show documents in trash
select nbase.NBS_UUID, nbase.NBS_NAME, nbase.NBS_CONTEXT from OKM_NODE_DOCUMENT ndoc, OKM_NODE_BASE nbase where ndoc.NBS_UUID = nbase.NBS_UUID and NBS_CONTEXT='okm_trash';
Contents
MySQL
SELECT concat('DROP TABLE IF EXISTS ', table_name, ';')
FROM information_schema.tables
WHERE table_schema = 'okmdb';
Para que no molestar la integridad referencial:
SET FOREIGN_KEY_CHECKS = 0;
drop table if exists ...;
drop table if exists ...;
drop table if exists ...;
SET FOREIGN_KEY_CHECKS = 1;
Para que no salgan los resultados con separadores hay que iniciar MySQL así:
$ mysql -h localhost -u root -p -s -r
TO DO
- http://doc.ubuntu.com/ubuntu/serverguide/C/libvirt.html
- http://yoadminsis.blogspot.com/2010/05/kvm-y-libvirt-bin-en-kubuntu-lucid-lynx.html
- http://www.eslomas.com/index.php/archives/2008/10/06/migrando-de-xen-a-kvm-en-ubuntu/