I am using Couchbase Server 4.5.1.
I am trying to cbrestore a bucket, which has been backed up with cbbackup on Ubuntu, and I am getting the following exception:
/Applications/Couchbase\ Server.app/Contents/Resources/couchbase-core/bin/cbrestore . http://localhost:8091 -u Administrator -p st0ryplAyr --bucket-source=storyplayer-api --bucket-destination=storyplayer-api -v -x rehash=1
2017-06-27 09:51:02,610: mt cbrestore...
2017-06-27 09:51:02,610: mt source : .
2017-06-27 09:51:02,610: mt sink : http://localhost:8091
2017-06-27 09:51:02,610: mt opts : {'username': '<xxx>', 'verbose': 1, 'extra': {'max_retry': 10.0, 'rehash': 1.0, 'dcp_consumer_queue_length': 1000.0, 'data_only': 0.0, 'uncompress': 0.0, 'nmv_retry': 1.0, 'conflict_resolve': 1.0, 'cbb_max_mb': 100000.0, 'report': 5.0, 'mcd_compatible': 1.0, 'try_xwm': 1.0, 'backoff_cap': 10.0, 'batch_max_bytes': 400000.0, 'report_full': 2000.0, 'flow_control': 1.0, 'batch_max_size': 1000.0, 'seqno': 0.0, 'design_doc_only': 0.0, 'recv_min_bytes': 4096.0}, 'ssl': False, 'threads': 4, 'to_date': None, 'key': None, 'password': '<xxx>', 'id': None, 'bucket_source': 'storyplayer-api', 'silent': False, 'dry_run': False, 'from_date': None, 'bucket_destination': 'storyplayer-api', 'add': False, 'vbucket_list': None}
2017-06-27 09:51:02,615: mt bucket: storyplayer-api
Exception in thread s0:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/lib/python/pump_mc.py", line 91, in run
rv, batch, need_backoff = self.scatter_gather(mconns, batch)
File "/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/lib/python/pump_cb.py", line 72, in scatter_gather
rv, conn = self.find_conn(mconns, vbucket_id, msgs)
File "/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/lib/python/pump_cb.py", line 316, in find_conn
host_port = serverList[vBucketMap[vbucket_id][0]]
IndexError: list index out of range
I had the same error (or comparable) previously which is why I am using the option rehash=1 but this time it does not help.
Any idea about what I could do?
I'm a little bit late to answer this question, but you have to add "-x rehash=1" to your command:
cbrestore ~/backups http://127.0.0.1:8091 -u Administrator -p password -x rehash=1
There reason why is that Couchbase has 1024 vbuckets on most operational systems, but on Mac there are just 64 vBuckets (for optmization purposes ), so you need to rehash to redistribute the data between all vbuckets
Related
According to info here, plugin_host is an external process that is used to execute plugin code. Unfortunately I'm getting an error (see title) and I probably need to configure this process but how? Thanks
Please note I'm using 32-bit version (https://www.sublimetext.com/3) on Debian 11.
System packages (zip files) are installed in /usr/local/share/sublime-text/Packages
I created symlink in /usr/local/bin linked to the previous folder
Python is installed in $HOME/.config/sublime-text-3/Lib/python3.3
both sublime.py and sublime_plugin.py files are located in $HOME/.config/sublime-text-3/Lib/ folder
Console output:
UI scale: 1.002 (gtk text scale)
startup, version: 3211 linux x32 channel: stable
executable: /usr/local/bin/sublime
working dir: /
packages path: /home/fox/.config/sublime-text-3/Packages
state path: /home/fox/.config/sublime-text-3/Local
zip path: /usr/local/bin/Packages
zip path: /home/fox/.config/sublime-text-3/Installed Packages
ignored_packages: ["Markdown", "Vintage"]
pre session restore time: 0.320594
startup time: 1.57776
first paint time: 1.8247
error: plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted
Preferences.sublime-settings:
{
"update_check": false,
"color_scheme": "Packages/dark.scheme",
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"detect_indentation" : false,
"copy_with_empty_selection": false,
"find_selected_text": true,
"detect_slow_plugins": false,
"auto_complete_delay": 500,
"font_face" : "Source Code Pro",
"font_options":
[
"directwrite"
],
"font_size": 14,
"highlight_line": true,
"ignored_packages": ["Markdown", "Vintage"]
}
❯ /usr/local/bin/plugin_host
Unexpected number of arguments, expected 2
❯ /usr/local/bin/plugin_host --help
unable to open channels
Unable to receive email on task failure or even using EmailOperator
Hi Guys,
I am unable to receive email from my box even after adding required parameters to send one.
Below is how my default args looks like --
default_args = {
'owner': 'phonrao',
'depends_on_past': False,
#'start_date': datetime(2019, 3, 28),
'start_date': airflow.utils.dates.days_ago(2),
'email': ['phonrao#gmail.com'],
'email_on_failure': True,
'email_on_retry': True,
'retries': 1,
'retry_delay': timedelta(minutes=5),
#'on_failure_callback': report_failure,
#'end_date': datetime(2020,4 ,1),
#'schedule_interval': '#hourly',
}
I have few HttpsOperator task in between -- those are working good and are a success, but they do not send email on error(I purposely tried to introduce an error to check if they send any email). Below is an example of my task.
t1 = SimpleHttpOperator(
task_id='t1',
http_conn_id='http_waterfall',
endpoint='/update_data',
method='POST',
headers={"Content-Type":"application/json"},
xcom_push=True,
log_response=True,
dag=dag,
)
and this is my EmailOperator task
t2 = EmailOperator(
dag=dag,
task_id="send_email",
to='phonrao#gmail.com',
subject='Success',
html_content="<h3>Success</h3>"
)
t2 >> t1
Below is the error from Logs:
[2019-04-02 15:28:21,305] {{base_task_runner.py:101}} INFO - Job 845: Subtask send_email [2019-04-02 15:28:21,305] {{cli.py:520}} INFO - Running <TaskInstance: schedulerDAG.send_email 2019-04-02T15:23:08.896589+00:00 [running]> on host a47cd79aa987
[2019-04-02 15:28:21,343] {{logging_mixin.py:95}} INFO - [2019-04-02 15:28:21,343] {{configuration.py:255}} WARNING - section/key [smtp/smtp_user] not found in config
[2019-04-02 15:28:21,343] {{models.py:1788}} ERROR - [Errno 99] Cannot assign requested address
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/airflow/models.py", line 1657, in _run_raw_task
result = task_copy.execute(context=context)
File "/usr/local/lib/python3.6/site-packages/airflow/operators/email_operator.py", line 78, in execute
mime_subtype=self.mime_subtype, mime_charset=self.mime_charset)
File "/usr/local/lib/python3.6/site-packages/airflow/utils/email.py", line 55, in send_email
mime_subtype=mime_subtype, mime_charset=mime_charset, **kwargs)
File "/usr/local/lib/python3.6/site-packages/airflow/utils/email.py", line 101, in send_email_smtp
send_MIME_email(smtp_mail_from, recipients, msg, dryrun)
File "/usr/local/lib/python3.6/site-packages/airflow/utils/email.py", line 121, in send_MIME_email
s = smtplib.SMTP_SSL(SMTP_HOST, SMTP_PORT) if SMTP_SSL else smtplib.SMTP(SMTP_HOST, SMTP_PORT)
File "/usr/local/lib/python3.6/smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "/usr/local/lib/python3.6/smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/local/lib/python3.6/smtplib.py", line 307, in _get_socket
self.source_address)
File "/usr/local/lib/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/local/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address
[2019-04-02 15:28:21,351] {{models.py:1817}} INFO - All retries failed; marking task as FAILED
Below is my airflow.cfg
[email]
email_backend = airflow.utils.email.send_email_smtp
[smtp]
# If you want airflow to send emails on retries, failure, and you want to use
# the airflow.utils.email.send_email_smtp function, you have to configure an
# smtp server here
smtp_host = localhost
smtp_starttls = True
smtp_ssl = False
# Uncomment and set the user/pass settings if you want to use SMTP AUTH
# smtp_user = airflow
# smtp_password = airflow
smtp_port = 25
smtp_mail_from = airflow#example.com
Has anyone encounter this issue and any suggestions on how do I resolve this?
If your airflow running on Kubernetes (installed by helm chart), you should take a look in "airflow-worker-0" pod, and make sure the environment variable of SMTP_HOST or SMTP_USER ... available in the config. Simply debugging, access to the container of airflow-worker and then run python, then trying these commands to make sure it works correctly.
import airflow
airflow.utils.email.send_email('example#gmail.com', 'Airflow TEST HERE', 'This is airflow status success')
I have the same issues, by resolving the environment variable of SMTP. Now it works.
When I'm trying to take data backup from couchbase VM using the below command
cbbackup -v http://...:8091 /opt/couchbase/backup -u Administrator -p ******. I'm getting the below error.
2018-10-22 07:13:01,647: mt cbbackup...
2018-10-22 07:13:01,648: mt source : http://**.***.**.***:8091
2018-10-22 07:13:01,648: mt sink : /opt/couchbase/backup
2018-10-22 07:13:01,648: mt opts : {'username': '<xxx>', 'verbose': 1, 'extra':
{'max_retry': 10.0, 'rehash': 0.0, 'dcp_consumer_queue_length': 1000.0, 'data_only': 0.0, 'uncompress': 0.0, 'nmv_retry': 1.0, 'conflict_resolve': 1.0, 'cbb_max_mb': 100000.0, 'report': 5.0, 'mcd_compatible': 1.0, 'try_xwm': 1.0, 'backoff_cap': 10.0, 'batch_max_bytes': 400000.0, 'report_full': 2000.0, 'flow_control': 1.0, 'batch_max_size': 1000.0, 'seqno': 0.0, 'design_doc_only': 0.0, 'allow_recovery_vb_remap': 0.0, 'recv_min_bytes': 4096.0}
, 'collection': None, 'ssl': False, 'threads': 4, 'key': None, 'password': '<xxx>', 'id': None, 'bucket_source': None, 'silent': False, 'dry_run': False, 'single_node': False, 'vbucket_list': None, 'separator': '::', 'mode': 'diff'}
2018-10-22 07:13:01,655: mt Starting new HTTP connection (1): *********
2018-10-22 07:13:01,662: mt bucket: sample_bucket
Exception in thread s3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self._target(*self.args, **self._kwargs)
File "/opt/couchbase/lib/python/pump_bfd.py", line 646, in run
return self.future_done(future, rv)
UnboundLocalError: local variable 'future' referenced before assignment
I'm using couchbase EE 5.1.1
I'm getting the above error. Any suggestions?
Use cbbackupmgr instead for EE
I ended up reading the documentation and found out for Enterprise edition there's backup manger "cbbackupmgr" which is faster more efficient than cbbackup and cbrestore.
All it requires is to first configure an empty directory as backup directory. For more information pls read the link below.https://docs.couchbase.com/server/5.5/backup-restore/cbbackupmgr-tutorial.html
I am learning django version 1.11.4 through tutorial on the official documentation. I am using python 3.6.5 and mysql8 for database. I also use mysql.connector.django to connect to mysql database. I tried to do the first Django app, part 2.
This is the link of the example I used
everything works fine except when I run the this command:
Question.objects.all()
I got the following error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/query.py", line 226, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/query.py", line 250, in __iter__
self._fetch_all()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/query.py", line 1118, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/query.py", line 62, in __iter__
for row in compiler.results_iter(results):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 839, in results_iter
for rows in results:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1284, in cursor_iter
sentinel):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1283, in <lambda>
for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/utils.py", line 101, in inner
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 510, in fetchmany
rows.extend(self._cnx.get_rows(size))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 275, in get_rows
row[i])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/conversion.py", line 205, in to_python
return self._cache_field_types[vtype[1]](value, vtype)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/django/base.py", line 119, in _DATETIME_to_python
dt = MySQLConverter._DATETIME_to_python(self, value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/conversion.py", line 506, in _DATETIME_to_python
(date_, time_) = value.split(b' ')
AttributeError: 'datetime.datetime' object has no attribute 'split'
the code used in the models file :
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def was_published_recently(self):
return self.pub_date >= timezone.now() -
datetime.timedelta(days=1)
def __str__(self):
return self.question_text
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text
the database setting:
DATABASES = {
'default': {
'NAME': 'mysite',
'ENGINE': 'mysql.connector.django',
'USER': 'root',
'PASSWORD': '********',
'OPTIONS': {
'autocommit': True,
},
}
}
any clue or help to fix this error will be appreciated.
I struggled for few hours to set up my Django project with python3 using MySQL DB on MacOS.
I was not able to install either mysqlclient and MySQL-Python by pip3 in a virtual environment created with virtualenv
error stacktrace was: something wrong due to configparser in python3
Jans-MacBook-Pro:~ jan$ /Library/Frameworks/Python.framework/Versions/3.3/bin/pip-3.3 install MySQL-python
Downloading/unpacking MySQL-python
Running setup.py egg_info for package MySQL-python
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python/setup.py", line 14, in <module>
from setup_posix import get_config
File "./setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python/setup.py", line 14, in <module>
from setup_posix import get_config
File "./setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python
Storing complete log in /Users/jan/.pip/pip.log
Jans-MacBook-Pro:~ jan$
Now the SOLUTION which worked for me was
1) installing mysql with brew again
brew install mysql
2) upgrading mysql with brew to latest version (if required)
brew upgrade mysql
3) installing mysqlclient now with pip3 (installing globally without virtualenv)
pip3 install mysqlclient
4) now access virtualenv and instal the mysqlclient in it, it will install fine without any error for configparser
As can be seen in the bug report posted by #Alasdair, the solution is:
Set use_pure=True in DATABASES['default']['OPTIONS'].
I too went through this pain yesterday or 2 days ago and was able to get it running with the mysqlclient-1.3.12. I'm going from memory here so bear with me, I tried a lot of things but eventually I got it to work.
I installed mysql8 and mysql8connector from the mysql web site as you did but got no love. After much searching and many trial and errors I found an answer somewhere which I can't find my way back to but I ended up doing:
brew install mysql
pip install mysqlclient
I know that you already have mysql installed but brew install mysql seems to add client libraries that are used to compile the mysqlclient connector. Then my database in my settings file looks like:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'polls',
'USER': 'myuser',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
'charset': 'utf8mb4',
'autocommit': True,
},
}
}
Note the ENGINE is different. I can replicate your exact error if I change my ENGINE to mysql.connector.django.
However, using django.db.backends.mysql I still get the following warning:
lib/python3.6/site-packages/django/db/backends/mysql/base.py:71: Warning: (3719, "'utf8' is currently an alias for the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous."
which I can't figure out, but as it is only a warning the Django tutorial seems to be working fine.
Let me know if this helps or if you have other questions and I'll do my best to help.
This is mysql-connector-python data conversion issue. You can get around this by setting the database options parameter with use_pure=true. This issue is not fixed in the current version 8.0.11,8.0.12, and 8.0.13.
"OPTIONS":{
"use_pure":True
}
This is just a temporary solution. Refer here for more information: https://bugs.mysql.com/bug.php?id=90541
I'm trying to install the django-balanced app in my project and I'm getting an error.
I did the following as the readme file says:
#Add to settings
import os
BALANCED = {
'API_KEY': os.environ.get('BALANCED_API_KEY'),
}
INSTALLED_APPS = (
...
'django.contrib.admin', # if you want to use the admin interface
'django_balanced',
...
)
#ran the following on my project root folder
BALANCED_API_KEY=YOUR_API_KEY django-admin.py syncdb #replacing the YOUR_API_KEY with my key
When I do this, I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/django/core/management/commands/syncdb.py", line 8, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/Library/Python/2.7/site-packages/django/core/management/sql.py", line 9, in <module>
from django.db import models
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 11, in <module>
if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
When I do the python manage.py syncdb, I get no errors with the database. I might be missing something in the database setting that the readme file does not mention. Thanks in advance
here is my database settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'payload', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': 'pass123', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
You can also type the following command
BALANCED_API_KEY=YOUR_API_KEY python manage.py syncdb
You need to set the DJANGO_SETTINGS_MODULE:
You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings