Monday, July 20, 2009

trac

sudo -u  trac-admin /home/svn/trac/  initenv
path to repository of svn

тепер треба встановити плагіни для зручної роботи та керування
потрібен плагін  WebAdmin.. починаючи з версії  trac-0.11 він вже є в ньому по замовчуванні.
треба лише його ввімкнути в trac.ini

[components]
webadmin.* = enabled


потім не забудть додати алміністратора для trac-у




trac-admin /path/to/my/project permission add username-from-htpasswd TRAC_ADMIN




далі ставимо плагін AccountManagerPlugin....
на сторінці цього  плагіну http://trac-hacks.org/wiki/AccountManagerPluginв розділі  Source  знаходимо посилання для скачування плагіну для своєї версії trac-у ..
завантажуємо
розархівовуємо

unzip accountmanagerplugin_0.11-r7529.zip
cd accountmanagerplugin/0.11/
читаємо README
python setup.py bdist_egg
cp dist/TracAccountManager-0.2.1dev-py2.6.egg /path/to/trac/plugin

якщо будете використовувати файл паролів в форматі htpasswd, то дописуємло в trac.ini таку секції ( конкретніше взяти з README)

[account-manager]
password_format = htpasswd
password_file = /path/to/trac.htpasswd
якщо файл паролів в форматі htdigest, то

[account-manager]
password_format = htdigest
password_file = /path/to/trac.htdigest
htdigest_realm = TracDigestRealm





trac.ini
.......
[account-manager]
account_changes_notify_addresses =
force_passwd_change = True
generated_password_length = 8
hash_method = HtDigestHashMethod
htdigest_realm = realm
notify_actions = []
password_file = /home/svn/trac/htdigest_trac
password_format = htdigest
password_store = HtDigestStore

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.htfile.htdigeststore = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = disabled
trac.web.auth.loginmodule = disabled
webadmin.* = enabled
..........
cp             your_project_logo.png      /home/svn/trac//htdocs/
htdigest -c /home/svn/trac/htdigest_trac  realm    user
trac-admin     /home/svn/trac/trac_repos permission  add user TRAC_ADMIN
saslpasswd2    -f     /path/to/file   -u realm  user

Thursday, July 16, 2009

Linux TCP Tuning

Linux TCP Tuning

There are a lot of differences between Linux version 2.4 and 2.6, so first we'll cover the tuning issues that are the same in both 2.4 and 2.6. To change TCP settings in, you add the entries below to the file /etc/sysctl.conf, and then run "sysctl -p". 

Like all operating systems, the default maximum Linux TCP buffer sizes are way too small. I suggest changing them to the following settings: 
  # increase TCP max buffer size setable using setsockopt()
  net.core.rmem_max = 16777216
  net.core.wmem_max = 16777216
  # increase Linux autotuning TCP buffer limits
  # min, default, and max number of bytes to use
  # set max to at least 4MB, or higher if you use very high BDP paths
  net.ipv4.tcp_rmem = 4096 87380 16777216 
  net.ipv4.tcp_wmem = 4096 65536 16777216

You should also verify that the following are all set to the default value of 1 
  sysctl net.ipv4.tcp_window_scaling 
  sysctl net.ipv4.tcp_timestamps 
  sysctl net.ipv4.tcp_sack

Note: you should leave tcp_mem alone. The defaults are fine. 

Another thing you can try that may help increase TCP throughput is to increase the size of the interface queue. To do this, do the following: 
  ifconfig eth0 txqueuelen 1000

I've seen increases in bandwidth of up to 8x by doing this on some long, fast paths. This is only a good idea for Gigabit Ethernet connected hosts, and may have other side effects such as uneven sharing between multiple streams. 

Also, I've been told that for some network paths, using the Linux 'tc' (traffic control) system to pace traffic out of the host can help improve total throughput. 
Linux 2.4 

Starting with Linux 2.4, Linux has implemented a sender-side autotuning mechanism, so that setting the optimal buffer size on the sender is not needed. This assumes you have set large buffers on the receive side, as the sending buffer will not grow beyond the size of the receive buffer. 

However, Linux 2.4 has some other strange behavior that one needs to be aware of. For example: The value for ssthresh for a given path is cached in the routing table. This means that if a connection has has a retransmission and reduces its window, then all connections to that host for the next 10 minutes will use a reduced window size, and not even try to increase its window. The only way to disable this behavior is to do the following before all new connections (you must be root): 
  sysctl -w net.ipv4.route.flush=1

More information on various tuning parameters for Linux 2.4 are available in the Ipsysctl tutorial . 
Linux 2.6 

Starting in Linux 2.6.7 (and back-ported to 2.4.27), linux includes alternative congestion control algorithms beside the traditional 'reno' algorithm. These are designed to recover quickly from packet loss on high-speed WANs. 

Linux 2.6 also includes and both send and receiver-side automatic buffer tuning (up to the maximum sizes specified above). There is also a setting to fix the ssthresh caching weirdness described above. 

There are a couple additional sysctl settings for 2.6: 
  # don't cache ssthresh from previous connection
  net.ipv4.tcp_no_metrics_save = 1
  net.ipv4.tcp_moderate_rcvbuf = 1
  # recommended to increase this for 1000 BT or higher
  net.core.netdev_max_backlog = 2500
  # for 10 GigE, use this
  # net.core.netdev_max_backlog = 30000  

Starting with version 2.6.13, Linux supports pluggable congestion control algorithms . The congestion control algorithm used is set using the sysctl variable net.ipv4.tcp_congestion_control, which is set to cubic or reno by default, depending on which version of the 2.6 kernel you are using. 

To get a list of congestion control algorithms that are available in your kernel, run: 
  sysctl net.ipv4.tcp_available_congestion_control

The choice of congestion control options is selected when you build the kernel. The following are some of the options are available in the 2.6.23 kernel: 
reno: Traditional TCP used by almost all other OSes. (default) 
cubic: CUBIC-TCP (NOTE: There is a cubic bug in the Linux 2.6.18 kernel. Use 2.6.19 or higher!) 
bic: BIC-TCP 
htcp: Hamilton TCP 
vegas: TCP Vegas 
westwood: optimized for lossy networks 

For very long fast paths, I suggest trying cubic or htcp if reno is not is not performing as desired. To set this, do the following: 
 
 sysctl -w net.ipv4.tcp_congestion_control=htcp

More information on each of these algorithms and some results can be found here . 

More information on tuning parameters and defaults for Linux 2.6 are available in the file ip-sysctl.txt, which is part of the 2.6 source distribution. 

Warning on Large MTUs: If you have configured your Linux host to use 9K MTUs, but the connection is using 1500 byte packets, then you actually need 9/1.5 = 6 times more buffer space in order to fill the pipe. In fact some device drivers only allocate memory in power of two sizes, so you may even need 16/1.5 = 11 times more buffer space! 

And finally a warning for both 2.4 and 2.6: for very large BDP paths where the TCP window is > 20 MB, you are likely to hit the Linux SACK implementation problem. If Linux has too many packets in flight when it gets a SACK event, it takes too long to located the SACKed packet, and you get a TCP timeout and CWND goes back to 1 packet. Restricting the TCP buffer size to about 12 MB seems to avoid this problem, but clearly limits your total throughput. Another solution is to disable SACK. 
Linux 2.2 

If you are still running Linux 2.2, upgrade! If this is not possible, add the following to /etc/rc.d/rc.local 
  echo 8388608 > /proc/sys/net/core/wmem_max  
  echo 8388608 > /proc/sys/net/core/rmem_max
  echo 65536 > /proc/sys/net/core/rmem_default
  echo 65536 > /proc/sys/net/core/wmem_default

Monday, July 6, 2009

як привязка номер інтерфейсу eth до мережевої карти

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="XX:XX:XX:XX:XX:XX", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Thursday, June 18, 2009

load data

select * from table  [where id=8917597 ] into outfile "file" ;

scp 

load data infile "/home/vova/" into table table ;

Tuesday, June 16, 2009

myisamchk

myisamchk -r -f -O key_buffer=2048M -O sort_buffer=256M -O read_buffer=16M -O write_buffer=16M /ssd/mysql/*/*MYI


-r или --recover При указании этой опции можно исправить практически все, кроме уникальных ключей, в которых есть повторения (ошибка, вероятность которой мизерна для таблиц ISAM/MyISAM). Если необходимо восстановить таблицу, то начинать надо с этой опции. Только если myisamchk сообщит, что таблица не может быть восстановлена с помощью -r, тогда следует пытаться применять -o (отметим, что в тех маловероятных случаях, когда -r не срабатывает, файл данных остается неизменным), В случае большого объема памяти следует увеличить размер sort_buffer_size!

-f или --force Писать поверх старых временных файлов (`table_name.TMD') вместо аварийного прекращения.


myisamchk -a key_buffer=2048M -O sort_buffer=256M -O read_buffer=16M -O write_buffer=16M /ssd/mysql/*/*MYI

Кроме ремонта и проверки таблиц, myisamchk может выполнять другие операции:
-a или --analyze
Анализировать распределение ключей. Улучшает эффективность операции связывания за счет включения оптимизатора связей. Он обеспечивает лучший порядок связывания таблиц и определяет, какие ключи при этом следует использовать: myisamchk --describe --verbose table_name или посредством SHOW KEYS в MySQL.

-S или --sort-index
Сортировать блоки индексного дерева в порядке от больших к меньшим (high-low). Этим оптимизируются операции поиска и повышается скорость сканирования по ключу.
-R или --sort-records=#
Сортирует записи в соответствии с индексом. Это значительно повышает локализацию данных и может ускорить операции SELECT и ORDER BY, которые выполняются по индексу и выбирают данные по какому-либо интервалу. (Возможно, что первая сортировка будет выполняться очень медленно!) Чтобы узнать номера индексов таблицы, нужно использовать команду SHOW INDEX, показывающую индексы таблицы в том же порядке, в каком их видит myisamchk. Индексы нумеруются начиная с 1.

Monday, June 15, 2009

швидкість samba

Увеличение скорости работы samba [исправить]
Установленная из пакета в ALT Linux samba демонстрировала невысокую скорость передачи данных:
1Мб/сек на прием и 700 Кб/сек на отдачу файлов по 100 Мбит ethernet сети.

Поискав на бескрайних просторах интернета, мне удалось найти следующее решение:
В файл /etc/samba/smb.conf в опцию [global] вставьте следующие строки:

[global]
max xmit = 64000
socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=64000 SO_RCVBUF=64000 SO_KEEPALIVE


Благодаря данным настройкам, пиковые значения скорости передачи данных по сети у меня увеличились
до 7.5Мб/сек на прием и 4 Мб/сек на отдачу файлов.

На сколько я помню, уже давно в самбе только параметр max xmit задан по умолчанию не лучшим образом. А основной прирост производительности делается за счет:
log file = /dev/null
log level = 0

[global]
max xmit = 65535
read raw = yes
write raw = yes
socket options = TCP_NODELAY SO_KEEPALIVE SO_RCVBUF=17520 SO_SNDBUF=17520 IPTOS_LOWDELAY
dead time = 15
MTU:1500 - большинство клиентов 100Мбит
WinXP гигабитный клиент 50Мбайт/сек, а 100 обычно 9,5 Мбайт/сек в обе стороны.
04:02.0 Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller (rev 05)
Ubuntu 8.04


re0: mtu 7422

socket options = SO_KEEPALIVE SO_BROADCAST TCP_NODELAY SO_RCVBUF=32768 SO_SNDBUF=32768 IPTOS_LOWDELAY

FreeBSD 7.0-RELEASE-p5

25-35мб/с

Wednesday, June 10, 2009

portdowngrade

portdowngrade -s anoncvs@anoncvs1.FreeBSD.org:/home/ncvs lang/php5